Method and apparatus for virtualizing window information

ABSTRACT

A method and apparatus for virtualizing access to windows includes a hooking mechanism, a window name virtualization engine, and an operating system interface. A request relating to a window from a process executing in the context of a user account is received, the request including a virtual window name. A determination is made for a literal name for the window, using a scope-specific identifier. A request is issued to the operating system including the determined literal window name. A window handle is associated with the determined virtual window name.

FIELD OF THE INVENTION

The invention relates to managing execution of software applications bycomputers and, in particular, to methods and apparatus for reducingcompatibility and sociability problems between different applicationprograms and between individual users of the same application executedby the same computer system.

BACKGROUND OF THE INVENTION

Computer software application programs, during execution andinstallation, make use of a variety of native resources provided by theoperating system of a computer. A traditional, single-user computer isdepicted in FIG. 1A. As shown in FIG. 1A, native resources provided bythe operating system 100 may include a file system 102, a registrydatabase 104, and objects 106. The file system 102 provides a mechanismfor an application program to open, create, read, copy, modify, anddelete data files 150, 152. The data files 150, 152 may be groupedtogether in a logical hierarchy of directories 160, 162. The registrydatabase 104 stores information regarding hardware physically attachedto the computer, which system options have been selected, how computermemory is set up, various items of application-specific data, and whatapplication programs should be present when the operating system 100 isstarted. As shown in FIG. 1A, the registry database 104 is commonlyorganized in a logical hierarchy of “keys” 170, 172 which are containersfor registry values. The operating system 100 may also provide a numberof communication and synchronization objects 106, including semaphores,sections, mutexes, timers, mutants, and pipes. Together, the file system102, registry database 104, objects 106, and any other native resourcesmade available by the operating system 100 will be referred tothroughout this document as the “system layer” 108. The resourcesprovided by the system layer 108 are available to any application orsystem program 112, 114.

A problem arises, however, when execution or installation of twoincompatible application programs 112, 114 is attempted. As shown inFIG. 1A, two application programs, APP1 112 and APP2 114, execute “ontop of” the operating system 100, that is, the application programs makeuse of functions provided by the operating system to access nativeresources. The application programs are said to be incompatible with oneanother when they make use of native resources 102, 104, 106 in amutually exclusive manner either during execution or during theinstallation process. APP1 112 may require, or attempt to install, afile located by the pathname c:\windows\system32\msvcrt.dll and APP2 114may require, or attempt to install, a second, different file that islocated by the same pathname. In this case, APP1 112 and APP2 114 cannotbe executed on the same computer and are said to be incompatible withone another. A similar problem may be encountered for other nativeresources. This is, at best, inconvenient for a user of the computer whorequires installation or execution of both APP1 112 and APP2 114together in the same operating system 100 environment.

FIG. 1B depicts a multi-user computer system supporting concurrentexecution of application programs 112, 114, 112′, 114′ on behalf ofseveral users. As shown in FIG. 1B, a first instance of APP1 112 and afirst instance of APP2 114 are executed in the context of a first usersession 110, a second instance of APP1 112′ is executed in the contextof a second user session 120, and a second instance of APP2 114′ isexecuted in the context of a third user session 130. In thisenvironment, a problem arises if both instances of APP1 112, 112′ andboth instances of APP2 114, 114′ make use of native resources 102, 104,106 as if only a single user executes the application. For example, theAPP1 112 may store application specific data in a registry key 170. Whenthe first instance of APP1 112 executing in the first user context 110and the second instance of APP1 112′ executing in the second usercontext 120 both attempt to store configuration data to the sameregistry key 170, incorrect configuration data will be stored for one ofthe users. A similar problem can occur for other native resources, suchas window names and window class information.

The present invention addresses these application program compatibilityand sociability problems.

BRIEF SUMMARY OF THE INVENTION

The present invention allows installation and execution of applicationprograms that are incompatible with each other, and incompatibleversions of the same application program, on a single computer. Inaddition, it allows the installation and execution on a multi-usercomputer of programs that were created for a single-user computer orwere created without consideration for issues that arise when executingon a multi-user computer. The methods and apparatus described areapplicable to single-user computing environments, which includesenvironments in which multiple users may use a single computer one afterthe other, as well as multi-user computing environments, in whichmultiple users concurrently use a single computer. The present inventionvirtualizes user and application access to native resources, such as thefile system, the registry database, system objects, window classes andwindow names, without modification of the application programs or theunderlying operating system. In addition, virtualized native resourcesmay be stored in native format (that is, virtualized files are stored inthe file system, virtualized registry entries are stored in the registrydatabase, etc.) allowing viewing and management of virtualized resourcesto be accomplished using standard tools and techniques.

In one aspect, the invention relates to a method for virtualizing accessto windows. A request relating to a window from a process executing inthe context of a user account is received, the request including avirtual window name. A determination is made for a literal name for thewindow, using a scope-specific identifier. A request is issued to theoperating system including the determined literal window name. A windowhandle is associated with the determined virtual window name.

In one embodiment, the request relating to a window from a processexecuting in the context of a user account is intercepted. In anotherembodiment, a rule associated with the virtual window name included inthe request is determined and used to determine a literal name for thewindow. In some embodiments, the virtual window name is stored in amapping table associated with a window handle.

In another aspect, the invention relates to a method for virtualizingaccess to windows. A request is received to identify one of a virtualwindow name and a virtual window class identifier, the request receivedfrom a process executing in the context of a user account and includinga window handle. It is determined that the window handle is associatedwith the requested one of the virtual window name and the virtual windowclass identifier. The determined window information is returned to therequesting process. In one embodiment, the window handle associated withthe requested one of the virtual window name and the virtual windowclass identifier is determined from a mapping table.

In another aspect, the invention relates to an apparatus forvirtualizing access to windows. A hooking mechanism receives a requestrelating to a window from a process executing in the context of a useraccount, the request including one of a virtual window name and avirtual window class identifier. A window name virtualization engineforms one of a literal name for the window and a literal window classidentifier using the one of the virtual window name and the virtualwindow class identifier received in the request and a scope-specificidentifier. An operating system interface issues a request relating to awindow, the request including the one of the formed literal name and theformed literal window class identifier for the window.

In one embodiment, the hooking mechanism intercepts a request selectedfrom a group consisting of finding a window, creating a window,enumerating a window, destroying a window, setting a window name,retrieving a window name, retrieving a window class identifierassociated with the window, registering a window class, retrievinginformation about a window class and unregistering a window class. Inanother embodiment, a mapping table stores an association between awindow handle and one of the virtual window name and the virtual windowclass identifier.

In another aspect, the invention relates to a method for virtualizingaccess to windows. A request to paint a title bar for a window, thetitle bar including the window name, is intercepted from a requestor therequest including a window handle. The virtual window name associatedwith the window handle is determined. The title bar of the window ispainted using the virtual window name. It is indicated to the requestorthat the title bar has been painted.

In yet another aspect, the invention relates to a method forvirtualizing access to windows. A request relating to a window classfrom a process executing in the context of a user account is received,the request including a virtual window class identifier. A literalwindow class identifier is determined using a scope-specific identifier.A request is issued to the operating system, the request including thedetermined literal window class identifier.

In one embodiment, a rule associated with the virtual window classidentifier included in the request is identified and used to determine aliteral window class identifier responsive to the determined rule. Inanother embodiment, the virtual window class identifier is stored in amapping table associated with a window handle. In another embodiment,virtual window class identifier replaces the determined literal windowclass identifier in the response

BRIEF DESCRIPTION OF THE DRAWINGS

The invention is pointed out with particularity in the appended claims.The advantages of the invention described above, as well as furtheradvantages of the invention, may be better understood by reference tothe following description taken in conjunction with the accompanyingdrawings, in which:

FIG. 1A is a block diagram of a prior art operating system environmentsupporting execution of two application programs on behalf of a user;

FIG. 1B is a block diagram of a prior art operating system environmentsupporting concurrent execution of multiple applications on behalf ofseveral users;

FIG. 2A is a block diagram of an embodiment of a computer system havingreduced application program compatibility and sociability problems;

FIG. 2B is a diagram of an embodiment of a computer system havingreduced application program compatibility and sociability problems;

FIG. 2C is a flowchart showing one embodiment of steps taken toassociate a process with an isolation scope;

FIG. 3A is a flowchart showing one embodiment of steps taken tovirtualize access to native resources in a computer system;

FIG. 3B is a flowchart showing an embodiment of steps taken to identifya replacement instance in execute mode;

FIG. 3C is a flowchart depicting one embodiment of steps taken ininstall mode to identify a literal resource when a request to open anative resource is received that indicates the resource is being openedwith the intention of modifying it;

FIG. 3D is a flowchart depicting one embodiment of steps taken ininstall mode to identify the literal resource when a request to create avirtual resource is received;

FIG. 4 is a flowchart depicting one embodiment of the steps taken toopen an entry in a file system in the described virtualized environment;

FIG. 5 is a flowchart depicting one embodiment of the steps taken todelete an entry from a file system in the described virtualizedenvironment;

FIG. 6 is a flowchart depicting one embodiment of the steps taken toenumerate entries in a file system in the described virtualizedenvironment;

FIG. 7 is a flowchart depicting one embodiment of the steps taken tocreate an entry in a file system in the described virtualizedenvironment;

FIG. 7A is a flowchart depicting one embodiment of the steps taken toassign unique short filenames after creating a new file;

FIG. 8 is a flowchart depicting one embodiment of the steps taken toopen a registry key in the described virtualized environment;

FIG. 9 is a flowchart depicting one embodiment of the steps taken todelete a registry key in the described virtualized environment;

FIG. 10 is a flowchart depicting one embodiment of the steps taken toenumerate subkeys of a key in a registry database in the describedvirtualized environment;

FIG. 11 is a flowchart depicting one embodiment of the steps taken tocreate a registry key in the described virtualized environment;

FIG. 12 is a flowchart depicting one embodiment of the steps taken tovirtualize access to named objects;

FIG. 13 is a flowchart depicting one embodiment of the steps taken tovirtualize window names and window classes in the described environment;

FIG. 13A is a flowchart depicting one embodiment of the steps taken todetermine literal window names and window class names;

FIG. 14 is a flowchart depicting one embodiment of the steps taken toinvoke an out-of-process COM server in the described virtualizedenvironment;

FIG. 15 is a flowchart depicting one embodiment of the steps taken tovirtualize application invocation using file-type association; and

FIG. 16 is a flowchart depicting one embodiment of the steps taken tomove a process from a source isolation scope to a target isolation scope

INDEX

1.0 Isolation Environment Conceptual Overview

1.1 Application Isolation

1.2 User Isolation

1.3 Aggregate view of native resources

1.4 Association of processes with isolation scopes

1.4.1 Association of out-of-scope processes with isolation scopes

2.0 Virtualization Mechanism Overview

3.0 Installation into an isolation environment

4.0 Execution in an isolation environment

4.1 File system virtualization

4.1.1 File System Open Operations

4.1.2 File System Delete Operations

4.1.3 File System Enumerate Operations

4.1.4 File System Create Operations

4.1.5 Short Filename Management

4.2 Registry virtualization

4.2.1 Registry Open Operations

4.2.2 Registry Delete Operations

4.2.3 Registry Enumerate Operations

4.2.4 Registry Create Operations

4.3 Named object virtualization

4.4 Window name virtualization

4.5 Out-of-process COM server virtualization

4.6 Virtualized file-type association

4.7 Dynamic movement of processes between isolation environments

DETAILED DESCRIPTION OF THE INVENTION

1.0 Isolation Environment Conceptual Overview

1.1 Application Isolation

Referring now to FIG. 2A, one embodiment of a computer running undercontrol of an operating system 100 that has reduced applicationcompatibility and application sociability problems is shown. Theoperating system 100 makes available various native resources toapplication programs 112, 114 via its system layer 108. The view ofresources embodied by the system layer 108 will be termed the “systemscope”. In order to avoid conflicting access to native resources 102,104, 106, 107 by the application programs 112, 114, an isolationenvironment 200 is provided. As shown in FIG. 2A, the isolationenvironment 200 includes an application isolation layer 220 and a userisolation layer 240. Conceptually, the isolation environment 200provides, via the application isolation layer 220, an applicationprogram 112, 114, with a unique view of native resources, such as thefile system 102, the registry 104, objects 106, and window names 107.Each isolation layer modifies the view of native resources provided toan application. The modified view of native resources provided by alayer will be referred to as that layer's “isolation scope”. As shown inFIG. 2A, the application isolation layer includes two applicationisolation scopes 222, 224. Scope 222 represents the view of nativeresources provided to application 112 and scope 224 represents the viewof native resources provided to application 114. Thus, in the embodimentshown in FIG. 2A, APP1 112 is provided with a specific view of the filesystem 102′, while APP2 114 is provided with another view of the filesystem 102″ which is specific to it. In some embodiments, theapplication isolation layer 220 provides a specific view of nativeresources 102, 104, 106, 107 to each individual application programexecuting on top of the operating system 100. In other embodiments,application programs 112, 114 may be grouped into sets and, in theseembodiments, the application isolation layer 220 provides a specificview of native resources for each set of application programs.Conflicting application programs may be put into separate groups toenhance the compatibility and sociability of applications. In stillfurther embodiments, the applications belonging to a set may beconfigured by an administrator. In some embodiments, a “passthrough”isolation scope can be defined which corresponds exactly to the systemscope. In other words, applications executing within a passthroughisolation scope operate directly on the system scope.

In some embodiments, the application isolation scope is further dividedinto layered sub-scopes. The main sub-scope contains the baseapplication isolation scope, and additional sub-scopes contain variousmodifications to this scope that may be visible to multiple executinginstances of the application. For example, a sub-scope may containmodifications to the scope that embody a change in the patch level ofthe application or the installation or removal of additional features.In some embodiments, the set of additional sub-scopes that are madevisible to an instance of the executing application is configurable. Insome embodiments, that set of visible sub-scopes is the same for allinstances of the executing application, regardless of the user on behalfof which the application is executing. In others, the set of visiblesub-scopes may vary for different users executing the application. Instill other embodiments, various sets of sub-scopes may be defined andthe user may have a choice as to which set to use. In some embodiments,sub-scopes may be discarded when no longer needed. In some embodiments,the modifications contained in a set of sub-scopes may be mergedtogether to form a single sub-scope.

1.2 User Isolation

Referring now to FIG. 2B, a multi-user computer having reducedapplication compatibility and application sociability problems isdepicted. The multi-user computer includes native resources 102, 104,106, 107 in the system layer 108, as well as the isolation environment200 discussed immediately above. The application isolation layer 220functions as discussed above, providing an application or group ofapplications with a modified view of native resources. The userisolation layer 240, conceptually, provides an application program 112,114, with a view of native resources that is further altered based onuser identity of the user on whose behalf the application is executed.As shown in FIG. 2B, the user isolation layer 240 may be considered tocomprise a number of user isolation scopes 242′, 242″, 242′″, 242″″,242′″″, 242″″″ (generally 242). A user isolation scope 242 provides auser-specific view of application-specific views of native resources.For example, APP1 112 executing in user session 110 on behalf of user“a” is provided with a file system view 102′(a) that is altered ormodified by both the user isolation scope 242′ and the applicationisolation scope 222.

Put another way, the user isolation layer 240 alters the view of nativeresources for each individual user by “layering” a user-specific viewmodification provided by a user isolation scope 242′ “on top of” anapplication-specific view modification provided by an applicationisolation scope 222, which is in turn “layered on top of” thesystem-wide view of native resources provided by the system layer. Forexample, when the first instance of APP1 112 accesses an entry in theregistry database 104, the view of the registry database specific to thefirst user session and the application 104′(a) is consulted. If therequested registry key is found in the user-specific view of theregistry 104′(a), that registry key is returned to APP1 112. If not, theview of the registry database specific to the application 104′ isconsulted. If the requested registry key is found in theapplication-specific view of the registry 104′, that registry key isreturned to APP1 112. If not, then the registry key stored in theregistry database 104 in the system layer 108 (i.e. the native registrykey) is returned to APP1 112.

In some embodiments, the user isolation layer 240 provides an isolationscope for each individual user. In other embodiments, the user isolationlayer 240 provides an isolation scope for a group of users, which may bedefined by roles within the organization or may be predetermined by anadministrator. In still other embodiments, no user isolation layer 240is provided. In these embodiments, the view of native resources seen byan application program is that provided by the application isolationlayer 220. The isolation environment 200, although described in relationto multi-user computers supporting concurrent execution of applicationprograms by various users, may also be used on single-user computers toaddress application compatibility and sociability problems resultingfrom sequential execution of application programs on the same computersystem by different users, and those problems resulting frominstallation and execution of incompatible programs by the same user.

In some embodiments, the user isolation scope is further divided intosub-scopes. The modifications by the user isolation scope to the viewpresented to an application executing in that scope is the aggregate ofthe modifications contained within each sub-scope in the scope.Sub-scopes are layered on top of each other, and in the aggregate viewmodifications to a resource in a higher sub-scope override modificationsto the same resource in lower layers.

In some of these embodiments, one or more of these sub-scopes maycontain modifications to the view that are specific to the user. In someof these embodiments, one or more sub-scopes may contain modificationsto the view that are specific to sets of users, which may be defined bythe system administrators or defined as a group of users in theoperating system. In some of these embodiments, one of these sub-scopesmay contain modifications to the view that are specific to theparticular login session, and hence that are discarded when the sessionends. In some of these embodiments, changes to native resources byapplication instances associated with the user isolation scope alwaysaffects one of these sub-scopes, and in other embodiments those changesmay affect different sub-scopes depending on the particular resourcechanged.

1.3 Aggregate Views of Native Resources

The conceptual architecture described above allows an applicationexecuting on behalf of a user to be presented with an aggregate, orunified, virtualized view of native resources, specific to thatcombination of application and user. This aggregated view may bereferred to as the “virtual scope”. The application instance executingon behalf of a user is presented with a single view of native resourcesreflecting all operative virtualized instances of the native resources.Conceptually this aggregated view consists firstly of the set of nativeresources provided by the operating system in the system scope, overlaidwith the modifications embodied in the application isolation scopeapplicable to the executing application, further overlaid with themodifications embodied in the user isolation scope applicable to theapplication executing on behalf of the user. The native resources in thesystem scope are characterized by being common to all users andapplications on the system, except where operating system permissionsdeny access to specific users or applications. The modifications to theresource view embodied in an application isolation scope arecharacterized as being common to all instances of applicationsassociated with that application isolation scope. The modifications tothe resource view embodied in the user isolation scope are characterizedas being common to all applications associated with the applicableapplication isolation scope that are executing on behalf of the userassociated with the user isolation scope.

This concept can be extended to sub-scopes; the modifications to theresource view embodied in a user sub-scope are common to allapplications associated with the applicable isolation sub-scopeexecuting on behalf of a user, or group of users, associated with a userisolation sub-scope. Throughout this description it should be understoodthat whenever general reference is made to “scope,” it is intended toalso refer to sub-scopes, where those exist.

When an application requests enumeration of a native resource, such as aportion of the file system or registry database, a virtualizedenumeration is constructed by first enumerating the “system-scoped”instance of the native resource, that is, the instance found in thesystem layer, if any. Next, the “application-scoped” instance of therequested resource, that is the instance found in the appropriateapplication isolation scope, if any, is enumerated. Any enumeratedresources encountered in the application isolation scope are added tothe view. If the enumerated resource already exists in the view (becauseit was present in the system scope, as well), it is replaced with theinstance of the resource encountered in the application isolation scope.Similarly, the “user-scoped” instance of the requested resource, that isthe instance found in the appropriate user isolation scope, if any, isenumerated. Again, any enumerated resources encountered in the userisolation scope are added to the view. If the native resource alreadyexists in the view (because it was present in the system scope or in theappropriate application isolation scope), it is replaced with theinstance of the resource encountered in the user isolation scope. Inthis manner, any enumeration of native resources will properly reflectvirtualization of the enumerated native resources. Conceptually the sameapproach applies to enumerating an isolation scope that comprisesmultiple sub-scopes. The individual sub-scopes are enumerated, withresources from higher sub-scopes replacing matching instances from lowersub-scopes in the aggregate view.

In other embodiments, enumeration may be performed from the userisolation scope layer down to the system layer, rather than the reverse.In these embodiments, the user isolation scope is enumerated. Then theapplication isolation scope is enumerated and any resource instancesappearing in the application isolation scope that were not enumerated inthe user isolation scope are added to the aggregate view that is underconstruction. A similar process can be repeated for resources appearingonly in the system scope.

In still other embodiments, all isolation scopes may be simultaneouslyenumerated and the respective enumerations combined.

If an application attempts to open an existing instance of a nativeresource with no intent to modify that resource, the specific instancethat is returned to the application is the one that is found in thevirtual scope, or equivalently the instance that would appear in thevirtualized enumeration of the parent of the requested resource. Fromthe point of view of the isolation environment, the application is saidto be requesting to open a “virtual resource”, and the particularinstance of native resource used to satisfy that request is said to bethe “literal resource” corresponding to the requested resource.

If an application executing on behalf of a user attempts to open aresource and indicates that it is doing so with the intent to modifythat resource, that application instance is normally given a privatecopy of that resource to modify, as resources in the applicationisolation scope and system scope are common to applications executing onbehalf of other users. Typically a user-scoped copy of the resource ismade, unless the user-scoped instance already exists. The definition ofthe aggregate view provided by a virtual scope means that the act ofcopying an application-scoped or system-scoped resource to a userisolation scope does not change the aggregate view provided by thevirtual scope for the user and application in question, nor for anyother user, nor for any other application instance. Subsequentmodifications to the copied resource by the application instanceexecuting on behalf of the user do not affect the aggregate view of anyother application instance that does not share the same user isolationscope. In other words, those modifications do not change the aggregateview of native resources for other users, or for application instancesnot associated with the same application isolation scope.

1.4 Association of Processes with Isolation Scopes

Applications may be installed into a particular isolation scope(described below in more detail). Applications that are installed intoan isolation scope are always associated with that scope. Alternatively,applications may be launched into a particular isolation scope, or intoa number of isolation scopes. In effect, an application is launched andassociated with one or more isolation scopes. The associated isolationscope, or scopes, provide the process with a particular view of nativeresources. Applications may also be launched into the system scope, thatis, they may be associated with no isolation scope. This allows for theselective execution of operating system applications such as InternetExplorer, as well as third party applications, within an isolationenvironment.

This ability to launch applications within an isolation scope regardlessof where the application is installed mitigates applicationcompatibility and sociability issues without requiring a separateinstallation of the application within the isolation scope. The abilityto selectively launch installed applications in different isolationscopes provides the ability to have applications which need helperapplications (such as Word, Notepad, etc.) to have those helperapplications launched with the same rule sets.

Further, the ability to launch an application within multiple isolatedenvironments allows for better integration between isolated applicationsand common applications.

Referring now to FIG. 2C, and in brief overview, a method forassociating a process with an isolation scope includes the steps oflaunching the process in a suspended state (step 282). The rulesassociated with the desired isolation scope are retrieved (step 284) andan identifier for the process and the retrieved rules are stored in amemory element (step 286) and the suspended process is resumed (step288). Subsequent calls to access native resources made by the processare intercepted or hooked (step 290) and the rules associated with theprocess identifier, if any, are used to virtualize access to therequested resource (step 292).

Still referring to FIG. 2C, and in more detail, a process is launched ina suspended state (step 282). In some embodiments, a custom launcherprogram is used to accomplish this task. In some of these embodiments,the launcher is specifically designed to launch a process into aselected isolation scope. In other embodiments, the launcher accepts asinput a specification of the desired isolation scope, for example, by acommand line option.

The rules associated with the desired isolation scope are retrieved(step 284). In some embodiments, the rules are retrieved from apersistent storage element, such as a hard disk drive or other solidstate memory element. The rules may be stored as a relational database,flat file database, tree-structured database, binary tree structure, orother persistent data structure. In other embodiments, the rules may bestored in a data structure specifically configured to store them.

An identifier for the process, such as a process id (PID), and theretrieved rules are stored in a memory element (step 286). In someembodiments, a kernel mode driver is provided that receives operatingsystem messages concerning new process creation. In these embodiments,the PID and the retrieved rules may be stored in the context of thedriver. In other embodiments, a file system filter driver, ormini-filter, is provided that intercepts native resource requests. Inthese embodiments, the PID and the retrieved rules may be stored in thefilter. In other embodiments still, all interception is performed byuser-mode hooking and no PID is stored at all. The rules are loaded bythe user-mode hooking apparatus during the process initialization, andno other component needs to know the rules that apply to the PID becauserule association is performed entirely in-process.

The suspended process is resumed (step 288) and subsequent calls toaccess native resources made by the process are intercepted or hooked(step 290) and the rules associated with the process identifier, if any,are used to virtualize access to the requested resource (step 292). Insome embodiments, a file system filter driver, or mini-filter,intercepts requests to access native resources and determines if theprocess identifier associated with the intercepted request has beenassociated with a set of rules. If so, the rules associated with thestored process identifier are used to virtualize the request to accessnative resources. If not, the request to access native resources ispassed through unmodified. In other embodiments, a dynamically-linkedlibrary is loaded into the newly-created process and the library loadsthe isolation rules. In still other embodiments, both kernel modetechniques (hooking, filter driver, mini-filter) and user-modetechniques are used to intercept calls to access native resources. Forembodiments in which a file system filter driver stores the rules, thelibrary may load the rules from the file system filter driver.

Processes that are “children” of processes associated with isolationscopes are associated with the isolation scopes of their “parent”process. In some embodiments, this is accomplished by a kernel modedriver notifying the file system filter driver when a child process iscreated. In these embodiments, the file system filter driver determinesif the process identifier of the parent process is associated with anisolation scope. If so, file system filter driver stores an associationbetween the process identifier for the newly-created child process andthe isolation scope of the parent process. In other embodiments, thefile system filter driver can be called directly from the system withoutuse of a kernel mode driver. In other embodiments, in processes that areassociated with isolation scopes, operating system functions that createnew processes are hooked or intercepted. When request to create a newprocess are received from such a process, the association between thenew child process and the isolation scope of the parent is stored.

In some embodiments, a scope or sub-scope may be associated with anindividual thread instead of an entire process, allowing isolation to beperformed on a per-thread basis. In some embodiments, per-threadisolation may be used for Services and COM+ servers.

1.4.1 Associating Out-of-scope Processes with Isolation Scopes

Another aspect of this invention is the ability to associate anyapplication instance with any application isolation scope, regardless ofwhether the application was installed into that application isolationscope, another application isolation scope or no application isolationscope. Applications which were not installed into a particularapplication scope can nevertheless be executed on behalf of a user inthe context of an application isolation scope and the corresponding userisolation scope, because their native resources are available to themvia the aggregated virtual scope formed by the user isolation scope,application isolation scope and system scope. Where it is desired to runan application in an isolation scope, this provides the ability forapplications installed directly into the system scope to be run withinthe isolation scope without requiring a separate installation of theapplication within the isolation scope. This also provides the abilityfor applications installed directly into the system scope to be used ashelper applications in the context of any isolation scope.

Each application instance, including all of the processes that make upthe executing application, is associated with either zero or oneapplication isolation scopes, and by extension exactly zero or onecorresponding user isolation scopes. This association is used by therules engine when determining which rule, if any, to apply to a resourcerequest. The association does not have to be to the applicationisolation scope that the application was installed into, if any. Manyapplications that are installed into an isolation scope will notfunction correctly when running in a different isolation scope or noisolation scope because they cannot find necessary native resources.However, because an isolation scope is an aggregation of resource viewsincluding the system scope, an application installed in the system scopecan generally function correctly inside any application isolation scope.This means that helper programs, as well as out-of-process COM servers,can be invoked and executed by an application executing on behalf of auser in a particular isolation scope.

In some embodiments, applications that are installed in the system scopeare executed in an isolation scope for the purpose of identifying whatchanges are made to the computer's files and configuration settings as aresult of this execution. As all affected files and configurationsettings are isolated in the user isolation scope, these files andconfiguration settings are easily identifiable. In some of theseembodiments, this is used in order to report on the changes made to thefiles and configuration settings by the application. In someembodiments, the files and configuration settings are deleted at the endof the application execution, which effectively ensures that no changesto the computer's files and configuration setting are stored as a resultof application execution. In still other embodiments, the files andconfiguration settings are selectively deleted or not deleted at the endof the application execution, which effectively ensures that only somechanges to the computer's files and configuration setting are stored asa result of application execution.

2.0 Virtualization Mechanism Overview

Referring now to FIG. 3A, one embodiment of the steps to be taken tovirtualize access to native resources in execute mode, which will bedistinguished from install mode below, is shown. In brief overview, arequest to access a native resource is intercepted or received (step302). The request identifies the native resource to which access issought. The applicable rule regarding how to treat the received accessrequest is determined (step 304). If the rule indicates the requestshould be ignored, the access request is passed without modification tothe system layer (step 306) and the result returned to the requestor(step 310). If the rule indicates that the access request should beeither redirected or isolated, the literal instance of the resource thatsatisfies the request is identified (step 308), a modified orreplacement request for the literal resource is passed to the systemlayer (step 306) and the result is returned to the requestor (step 310).

Still referring to FIG. 3, and in more detail, a request identifying anative resource is intercepted or received (step 302). In someembodiments, requests for native resources are intercepted by “hooking”functions provided by the operating system for applications to makenative resource requests. In specific embodiments, this is implementedas a dynamically-linked library that is loaded into the address space ofevery new process created by the operating system, and which performshooking during its initialization routine. Loading a DLL into everyprocess may be achieved via a facility provided by the operating system,or alternatively by modifying the executable image's list of DLLs toimport, either in the disk file, or in memory as the executable imagefor the process is loaded from disk. In other embodiments, functionhooking is performed by a service, driver or daemon. In otherembodiments, executable images, including shared libraries andexecutable files, provided by the operating system may be modified orpatched in order to provide function hooks or to directly embody thelogic of this invention. For specific embodiments in which the operatingsystem is a member of the Microsoft WINDOWS family of operating systems,interception may be performed by a kernel mode driver hooking the SystemService Dispatch Table. In still other embodiments, the operating systemmay provide a facility allowing third parties to hook functions thatrequest access to native resources. In some of these embodiments, theoperating system may provide this facility via an applicationprogramming interface (API) or a debug facility.

In other embodiments, the native resource request is intercepted by afilter in the driver stack or handler stack associated with the nativeresource. For example, some members of the family of Microsoft WINDOWSoperating systems provide the capability to plug a third-party filterdriver or mini-filter into the file system driver stack and a filesystem filter driver or mini-filter may be used to provide the isolationfunctions described below. In still other embodiments the inventioncomprises a file system implementation that directly incorporates thelogic of this invention. Alternatively, the operating system may berewritten to directly provide the functions described below. In someembodiments, a combination of some or all of the methods listed above tointercept or receive requests for resources may be simultaneouslyemployed.

In many embodiments, only requests to open an existing native resourceor create a new native resource are hooked or intercepted. In theseembodiments, the initial access to a native resource is the access thatcauses the resource to be virtualized. After the initial access, therequesting application program is able to communicate with the operatingsystem concerning the virtualized resource using a handle or pointer orother identifier provided by the operating system that directlyidentifies the literal resource. In other embodiments, other types ofrequests to operate on a virtualized native resource are also hooked orintercepted. In some of these embodiments, requests by the applicationto open or create virtual resources return virtual handles that do notdirectly identify the literal resource, and the isolation environment isresponsible for translating subsequent requests against virtual handlesto the corresponding literal resource. In some of those embodiments,additional virtualization operations can be deferred until provennecessary. For example, the operation of providing a private modifiablecopy of a resource to an isolation scope can be deferred until a requestto change the resource is made, rather than when the resource is openedin a mode that allows subsequent modification.

Once the native resource request is intercepted or received, theapplicable rule determining how to treat the particular request isdetermined (step 304). The most applicable rule may be determined byreference to a rules engine, a database of rules, or a flat filecontaining rules organized using an appropriate data structure such as alist or a tree structure. In some embodiments, rules are accorded apriority that determines which rule will be regarded as most applicablewhen two or more rules apply. In some of these embodiments, rulepriority is included in the rules themselves or, alternatively, rulepriority may be embedded in the data structure used to store the rules,for example, rule priority may be indicated by a rule's position in atree structure. The determined rule may include additional informationregarding how to process the virtualized resource request such as, forexample, to which literal resource to redirect the request. In aspecific embodiment a rule is a triple comprising a filter field, anaction field, and data field. In this embodiment, the filter fieldincludes the filter used to match received native resource requests todetermine if the rule is valid for the requested resource name. Theaction field can be “ignore,” “redirect,” or “isolate”. The data fieldmay be any additional information concerning the action to be taken whenthe rule is valid, including the function to be used when the rule isvalid.

A rule action of “ignore” means the request directly operates on therequested native resource in the system scope. That is, the request ispassed unaltered to the system layer 108 (step 306) and the request isfulfilled as if no isolation environment 200 exists. In this case, theisolation environment is said to have a “hole”, or the request may bereferred to as a “passthrough” request.

If the rule action indicates that the native resource request should beredirected or isolated, then the literal resource that satisfies therequest is identified (step 308).

A rule action of “redirect” means that the request directly operates ona system-scoped native resource, albeit a different resource thanspecified in the request. The literal resource is identified by applyinga mapping function specified in, or implied by, the data field of thedetermined rule to the name of the requested native resource. In themost general case the literal native resource may be located anywhere inthe system scope. As a simple example, the rule {prefix_match(“c:\temp\”, resource name), REDIRECT, replace_prefix (“c:\temp\”,“d:\wutemp\”, resource name)} will redirect a requested access to thefile c:\temp\examples\d1.txt to the literal filed:\wutemp\examples\d1.txt. The mapping function included in the datafield of the rule and the matching function may be further generalizedto support complex behaviors by, for example, using regular expressions.Some embodiments may provide the ability to specify mapping functionsthat locate the literal resource within the user isolation scope or asub-scope applicable to the application executing on behalf of the user,or the application isolation scope or a sub-scope applicable to theapplication. Further embodiments may provide the ability to specifymapping functions that locate the literal resource within theapplication isolation scope applicable to a different application inorder to provide a controlled form of interaction between isolatedapplications. In some particular embodiments, the “redirect” action canbe configured to provide behavior equivalent to the “ignore” ruleaction. In these embodiments, the literal resource is exactly therequested native resource. When this condition is configured, theisolation environment may be said to have a “hole,” or the request maybe referred to as a “passthrough” request.

A rule action of “isolate” means that the request operates on a literalresource that is identified using the appropriate user isolation scopeand application isolation scope. That is, the identifier for the literalresource is determined by modifying the identifier for the requestednative resource using the user isolation scope, the applicationisolation scope, both scopes, or neither scope. The particular literalresource identified depends on the type of access requested and whetherinstances of the requested native resource already exist in theapplicable user isolation scope, the applicable application isolationscope and the system scope.

FIG. 3B depicts one embodiment of steps taken to identify the literalresource (step 306 in FIG. 3A) when a request to open a native resourceis received that indicates the resource is being opened with theintention of modifying it. Briefly, a determination is made whether theuser-scoped instance, that is, an instance that exists in an applicableuser scope or user sub-scope, of the requested native resource exists(step 354). If so, the user-scoped instance is identified as the literalresource for the request (step 372), and that instance is opened andreturned to the requester. If the user-scoped instance does not exist, adetermination whether the application-scoped instance of the requestednative resource exists is made (step 356). If the application-scopedinstance exists, it is identified as the “candidate” resource instance(step 359), and permission data associated with the candidate instanceis checked to determine if modification of that instance is allowed(step 362). If no application-scoped instance exists, then adetermination is made whether the system-scoped instance of therequested native resource exists (step 358). If it does not, an errorcondition is returned to the requestor indicating that the requestedvirtualized resource does not exist in the virtual scope (step 360).However, if the system-scoped resource exists, it is identified as thecandidate resource instance (step 361), and permission data associatedwith the candidate instance is checked to determine if modification ofthat instance is allowed (step 362). If not, an error condition isreturned to the requestor (step 364) indicating that modification of thevirtualized resource is not allowed. If the permission data indicatesthat the candidate resource may be modified, a user-scoped copy of thecandidate instance of the native resource is made (step 370), theuser-scoped instance is identified as the literal instance for therequest (step 372), and is opened and returned to the requester.

Still referring to FIG. 3B, and in more detail, a determination is madewhether the user-scoped resource exists, or in other words, whether therequested resource exists in the applicable user scope or sub-scope(step 354). The applicable user scope or sub-scope is the scopeassociated with the user that is layered on the application isolationscope associated with the application making the request. The userisolation scope or a sub-scope, in the file system case, may be adirectory under which all files that exist in the user isolation scopeare stored. In some of these embodiments, the directory tree structureunder the user isolation directory reflects the path of the requestedresource. For example, if the requested file is c:\temp\test.txt and theuser isolation scope directory is d:\user1\app1\, then the path to theuser-scoped literal file may be d:\user1\app1\c\temp\test.txt. In otherembodiments, the path to the user-scoped literal may be defined in anative naming convention. For example, the path to the user-scopedliteral file may be d:\user1\app1\device\harddisk1\temp\test.txt. Instill other embodiments, the user-scoped files may all be stored in asingle directory with names chosen to be unique and a database may beused to store the mapping between the requested file name and the nameof the corresponding literal file stored in the directory. In stillother embodiments, the contents of the literal files may be stored in adatabase. In still other embodiments, the native file system providesthe facility for a single file to contain multiple independent named“streams”, and the contents of the user-scoped files are stored asadditional streams of the associated files in the system scope.Alternatively, the literal files may be stored in a custom file systemthat may be designed to optimize disk usage or other criteria ofinterest.

If the user-scoped resource instance does not exist, then adetermination is made whether the application-scoped resource exists, orin other words whether the requested resource exists in the applicationisolation scope (step 356). The methods described above are used to makethis determination. For example, if the requested file isc:\temp\test.txt and the application isolation scope directory ise:\app1\, then the path to the application-scoped file may bee:\app1\c\temp\test.txt. As above, the path to the application-scopedfile may be stored in a native naming convention. The embodimentsdescribed above may also apply to the application isolation scope.

If the application-scoped resource does not exist, then a determinationis made whether the system-scoped resource exists, or in other words,whether the requested resource exists in the system scope (step 358).For example, if the requested file is c:\temp\test.txt then the path tothe system-scoped file is c:\temp\test.txt. If the requested resourcedoes not exist in the system scope, an indication that the requestedresource does not exist in the virtual scope is returned to therequestor (step 360).

Whether the candidate resource instance for the requested resource islocated in the application isolation scope or in the system scope, adetermination is made whether modification of the candidate resourceinstance is allowed (step 362). For example, the candidate nativeresource instance may have associated native permission data indicatingthat modification of the candidate instance is not allowed by that user.Further, the rules engine may include configuration settings instructingthe isolation environment to obey or override the native permission datafor virtualized copies of resources. In some embodiments, the rules mayspecify for some virtual resources the scope in which modifications areto occur, for example the system scope or the application isolationscope or a sub-scope, or the user isolation scope or a sub-scope. Insome embodiments, the rules engine may specify configuration settingsthat apply to subsets of the virtualized native resources based onhierarchy or on type of resource accessed. In some of these embodiments,the configuration settings may be specific to each atomic nativeresource. In another example, the rules engine may include configurationdata that prohibits or allows modification of certain classes of files,such as executable code or MIME types or file types as defined by theoperating system.

If the determination in step 362 is that modification of the candidateresource instance is not allowed, then an error condition is returned tothe requestor indicating that write access to the virtual resource isnot allowed (step 364). If the determination in step 362 is thatmodification of the candidate resource instance is allowed, then thecandidate instance is copied to the appropriate user isolation scope orsub-scope (step 370). For embodiments in which the logical hierarchystructure of the requested native resource is maintained in theisolation scopes, copying the candidate instance of the resource to theuser isolation scope may require the creation in the user isolationscope of hierarchy placeholders. A hierarchy placeholder is a node thatis placed in the hierarchy to correctly locate the copied resource inthe isolation scope. A hierarchy placeholder stores no data, isidentified as a placeholder node, and “does not exist” in the sense thatit cannot be the literal resource returned to a requestor. In someembodiments, the identification of a node as a placeholder node is madeby recording the fact in metadata attached to the node, or to the parentof the node, or to some other related entity in the system layer. Inother embodiments, a separate repository of placeholder node names ismaintained.

In some embodiments, the rules may specify that modifications toparticular resources may be made at a particular scope, such as theapplication isolation scope. In those cases the copy operation in step370 is expanded to determine whether modification to the candidateresource instance is allowed at the scope or sub-scope in which it isfound. If not, the candidate resource instance is copied to the scope orsub-scope in which modification is allowed, which may not always be theuser isolation scope, and the new copy is identified as the literalresource instance (step 372). If so, the candidate resource instance isidentified as the literal instance (step 372), and is opened and theresult returned to the requestor (step 306).

Referring back to FIG. 3A, the literal resource instance, whetherlocated in step 354 or created in step 370, is opened (step 306) andreturned to the requestor (step 310). In some embodiments, this isaccomplished by issuing an “open” command to the operating system andreturning to the requestor the response from the operating system to the“open” command.

If an application executing on behalf of a user deletes a nativeresource, the aggregated view of native resources presented to thatapplication as the virtual scope must reflect the deletion. A request todelete a resource is a request for a special type of modification,albeit one that modifies the resource by removing its existenceentirely. Conceptually a request to delete a resource proceeds in asimilar manner to that outlined in FIG. 3A, including the determinationof the literal resource as outlined in FIG. 3B. However, step 306operates differently for isolated resources and for redirected orignored resources. For redirect and ignore, the literal resource isdeleted from the system scope. For isolate, the literal resource is“virtually” deleted, or in other words the fact that it has been deletedis recorded in the user isolation scope. A deleted node contains nodata, is identified as deleted, and it and all of its descendants “donot exist”. In other words, if it is the resource or the ancestor of aresource that would otherwise satisfy a resource request a “resource notfound” error is returned to the requestor. Further details will beoutlined in Section 4. In some embodiments, the identification of a nodeas a deleted node is made by recording the fact in metadata attached tothe node, or to the parent of the node, or to some other related entityin the system layer. In other embodiments, a separate repository ofdeleted node names is maintained, for example, in a separate sub-scope.

3.0 Installation into an Isolation Environment

The application isolation scope described above can be considered as thescope in which associated application instances share resourcesindependently of any user, or equivalently on behalf of all possibleusers, including the resources that those application instances create.The main class of such resources is the set created when an applicationis installed onto the operating system. As shown in FIG. 1A, twoincompatible applications cannot both be installed into the same systemscope, but this problem can be resolved by installing at least one ofthose applications into an isolation environment.

An isolation scope, or an application instance associated with anisolation scope, can be operated in an “install mode” to supportinstallation of an application. This is in contrast to “execute mode”described below in connection with FIGS. 4-16. In install mode, theapplication installation program is associated with an applicationisolation scope and is presumed to be executing on behalf of all users.The application isolation scope acts, for that application instance, asif it were the user isolation scope for “all users”, and no userisolation scope is active for that application instance.

FIG. 3C depicts one embodiment of steps taken in install mode toidentify a literal resource when a request to open a native resource isreceived that indicates the resource is being opened with the intentionof modifying it. Briefly, as no user-isolation scope is active, adetermination is first made whether the application-scoped instance ofthe requested native resource exists (step 374). If theapplication-scoped instance exists, it is identified as the literalresource instance (step 384). If no application-scoped instance exists,a determination is made whether the system-scoped instance of therequested native resource exists (step 376). If it does not, an errorcondition is returned to the requestor indicating that the requestedvirtualized resource does not exist in the virtual scope (step 377).However, if the system-scoped resource exists, it is identified as thecandidate resource instance (step 378), and permission data associatedwith the candidate instance is checked to determine if modification ofthat instance is allowed (step 380). If not, an error condition isreturned to the requestor (step 381) indicating that modification of thevirtualized resource is not allowed. If the permission data indicatesthat the candidate resource may be modified, as no user-isolation scopeis active, an application-scoped copy of the candidate instance of thenative resource is made (step 382), and the application-scoped instanceis identified as the literal instance for the request (step 384). Insome embodiments, the candidate file is copied to a location defined bythe rules engine. For example, a rule may specify that the file iscopied to an application isolation scope. In other embodiments the rulesmay specify a particular application isolation sub-scope or userisolation sub-scope to which the file should be copied. Any ancestors ofthe requested file that do not appear in the isolation scope to whichthe file is copied are created as placeholders in the isolation scope inorder to correctly locate the copied instance in the hierarchy.

FIG. 3D shows one embodiment of steps taken in install mode to identifythe literal resource when a request to create a native resource isreceived. Briefly, as no user-isolation scope is active, a determinationis first made whether the application-scoped instance of the requestednative resource exists (step 390). If the application-scoped instanceexists, an error condition may be returned to the requestor indicatingthat the resource cannot be created because it already exists (step392). If no application-scoped instance exists, a determination may bemade whether the system-scoped instance of the requested native resourceexists (step 394). If the system-scoped instance exists, an errorcondition may be returned to the requestor indicating that the resourcecannot be created because it already exists (step 392). In someembodiments, the request used to open the resource may specify that anyextant system-scoped instance of the resource may be overwritten. If thesystem-scoped resource instance does not exist, the application-scopedresource instance may be identified as the literal instance which willbe created to fulfill the request (step 396).

By comparing FIG. 3B with FIGS. 3C and 3D, it can be seen that installmode operates in a similar manner to execute mode, with the applicationisolation scope taking the place of the user isolation scope. In otherwords, modifications to persistent resources, including creation of newresources, take place in the appropriate application isolation scopeinstead of the appropriate user isolation scope. Furthermore,virtualization of access to existing isolated resources also ignores theappropriate user isolation scope and begins searching for a candidateliteral resource in the application isolation scope.

There are two other cases where the application isolation scope operatesin this manner to contain modifications to existing resources andcreation of new resources. Firstly, there may be an isolationenvironment configured to operate without a user isolation layer, or avirtual scope configured to operate without a user isolation scope. Inthis case, the application isolation scope is the only isolation scopethat can isolate modified and newly created resources. Secondly, therules governing a particular set of virtual resources may specify thatthey are to be isolated into the appropriate application isolation scoperather than into the appropriate user isolation scope. Again, this meansmodifications to and creations of resources subject to that rule will beisolated into the appropriate application isolation scope where they arevisible to all application instances sharing that scope, rather than inthe user isolation scope where they are only visible to the userexecuting those application instances.

In still other embodiments, an isolation environment may be configuredto allow certain resources to be shared in the system scope, that is,the isolation environment may act, for one or more system resources, asif no user isolation scope and no application isolation scope exists.System resources shared in the system scope are never copied whenaccessed with the intent to modify, because they are shared by allapplications and all users, i.e., they are global objects.

4.0 Detailed Virtualization Examples

The methods and apparatus described above may be used to virtualize awide variety of native resources 108. A number of these are described indetail below.

4.1 File System Virtualization

The methods and apparatus described above may be used to virtualizeaccess to a file system. As described above, a file system is commonlyorganized in a logical hierarchy of directories, which are themselvesfiles and which may contain other directories and data files.

4.1.1 File System Open Operations

In brief overview, FIG. 4 depicts one embodiment of the steps taken toopen a file in the virtualized environment described above. A request toopen a file is received or intercepted (step 402). The request containsa file name, which is treated as a virtual file name by the isolationenvironment. The processing rule applicable to the target of the filesystem open request is determined (step 404). If the rule action is“redirect” (step 406), the virtual file name provided in the request ismapped to a literal file name according to the applicable rule (step408). A request to open the literal file using the literal file name ispassed to the operating system and the result from the operating systemis returned to the requestor (step 410). If instead the rule action is“ignore” (step 406), then the literal file name is determined to beexactly the virtual file name (step 412), and the request to open theliteral file is passed to the operating system and the result from theoperating system is returned to the requestor (step 410). If in step 406the rule action is “isolate”, then the file name corresponding to thevirtual file name in the user isolation scope is identified as thecandidate file name (step 414). In other words, the candidate file nameis formed by mapping the virtual file name to the corresponding nativefile name specific to the applicable user isolation scope. The categoryof existence of the candidate file is determined by examining the userisolation scope and any metadata associated with the candidate file(step 416). If the candidate file is determined to have “negativeexistence”, because either the candidate file or one of its ancestordirectories in the user isolation scope is marked as deleted, this meansthe requested virtual file is known to not exist. In this case, an errorcondition indicating the requested file is not found is returned to therequestor (step 422). If instead in step 416 the candidate file isdetermined to have “positive existence”, because the candidate fileexists in the user isolation scope and is not marked as a placeholdernode, then the requested virtual file is known to exist. The candidatefile is identified as the literal file for the request (step 418), and arequest issued to open the literal file and the result returned to therequestor (step 420). If, however, in step 416, the candidate file has“neutral existence” because the candidate file does not exist, or thecandidate file exists but is marked as a placeholder node, it is not yetknown whether the virtual file exists or not. In this case theapplication-scoped file name corresponding to the virtual file name isidentified as the candidate file name (step 424). In other words, thecandidate file name is formed by mapping the virtual file name to thecorresponding native file name specific to the applicable applicationisolation scope. The category of existence of the candidate file isdetermined by examining the application isolation scope and any metadataassociated with the candidate file (step 426). If the candidate file isdetermined to have “negative existence”, because either the candidatefile or one of its ancestor directories in the application isolationscope is marked as deleted, this means the requested virtual file isknown to not exist. In this case, an error condition indicating therequested file is not found is returned to the requestor (step 422). Ifinstead in step 426 the candidate file is determined to have “positiveexistence”, because the candidate file exists in the applicationisolation scope and is not marked as a placeholder node, then therequested virtual file is known to exist. The request is checked todetermine if the open request indicates an intention to modify the file(step 428). If not, the candidate file is identified as the literal filefor the request (step 418), and a request issued to open the literalfile and the result returned to the requestor (step 420). If, however,in step 428, it is determined that the open request indicates intentionto modify the file, permission data associated with the file is checkedto determine if modification of the file is allowed (step 436). If not,an error condition is returned to the requestor (step 438) indicatingthat modification of the file is not allowed. If the permission dataindicates that the file may be modified, the candidate file is copied tothe user isolation scope (step 440). In some embodiments, the candidatefile is copied to a location defined by the rules engine. For example, arule may specify that the file is copied to an application isolationscope. In other embodiments the rules may specify a particularapplication isolation sub-scope or user isolation sub-scope to which thefile should be copied. Any ancestors of the requested file that do notappear in the isolation scope to which the file is copied are created asplaceholders in the isolation scope in order to correctly locate thecopied instance in the hierarchy. The scoped instance is identified asthe literal file (step 442) and a request issued to open the literalfile and the result returned to the requestor (step 420). Returning tostep 426, if the candidate file has neutral existence because thecandidate file does not exist, or because the candidate file is foundbut marked as a placeholder node, it is not yet known whether thevirtual file exists or not. In this case, the system-scoped file namecorresponding to the virtual file name is identified as the candidatefile name (step 430). In other words, the candidate file name is exactlythe virtual file name. If the candidate file does not exist (step 432),an error condition indicating the virtual file was not found is returnedto the requestor (step 434). If on the other hand the candidate fileexists (step 432), the request is checked to determine if the openrequest indicates an intention to modify the file (step 428). If not,the candidate file is identified as the literal file for the request(step 418), and a request issued to open the literal file and the resultreturned to the requestor (step 420). If, however, in step 428, it isdetermined that the open request indicates intention to modify the file,permission data associated with the file is checked to determine ifmodification of the file is allowed (step 436). If not, an errorcondition is returned to the requestor (step 438) indicating thatmodification of the file is not allowed. If the permission dataindicates that the file may be modified, the candidate file is copied tothe user isolation scope (step 440). In some embodiments, the candidatefile is copied to a location defined by the rules engine. For example, arule may specify that the file is copied to an application isolationscope. In other embodiments the rules may specify a particularapplication isolation sub-scope or user isolation sub-scope to which thefile should be copied. Any ancestors of the requested file that do notappear in the isolation scope are created as placeholders in theisolation scope in order to correctly locate the copied instance in thehierarchy. The scoped instance is identified as the literal file (step442) and a request issued to open the literal file and the resultreturned to the requestor (step 420).

This embodiment can be trivially modified to perform a check forexistence of a file rather than opening a file. The attempt to open theliteral file in step 420 is replaced with a check for the existence ofthat literal file and that status returned to the requestor.

Still referring to FIG. 4 and now in more detail, a request to open avirtual file is received or intercepted (step 402). The correspondingliteral file may be of user isolation scope, application isolation scopeor system scope, or it may be scoped to an application isolationsub-scope or a user isolation sub-scope. In some embodiments, therequest is hooked by a function that replaces the operating systemfunction or functions for opening a file. In another embodiment ahooking dynamically-linked library is used to intercept the request. Thehooking function may execute in user mode or in kernel mode. Forembodiments in which the hooking function executes in user mode, thehooking function may be loaded into the address space of a process whenthat process is created. For embodiments in which the hooking functionexecutes in kernel mode, the hooking function may be associated with anoperating system resource that is used in dispatching requests fornative files. For embodiments in which a separate operating systemfunction is provided for each type of file operation, each function maybe hooked separately. Alternatively, a single hooking function may beprovided which intercepts create or open calls for several types of fileoperations.

The request contains a file name, which is treated as a virtual filename by the isolation environment. The processing rule applicable to thefile system open request is determined (step 404) by consulting therules engine. In some embodiments the processing rule applicable to theopen request is determined using the virtual name included in the openrequest. In some embodiments, the rules engine may be provided as arelational database. In other embodiments, the rules engine may be atree-structured database, a hash table, or a flat file database. In someembodiments, the virtual file name provided for the requested file isused as an index into the rule engine to locate one or more rules thatapply to the request. In particular ones of these embodiments, multiplerules may exist in the rules engine for a particular file and, in theseembodiments, the rule having the longest prefix match with the virtualfile name is the rule applied to the request. In other embodiments, aprocess identifier is used to locate in the rule engine a rule thatapplies to the request, if one exists. The rule associated with arequest may be to ignore the request, redirect the request, or isolatethe request. Although shown in FIG. 4 as a single database transactionor single lookup into a file, the rule lookup may be performed as aseries of rule lookups.

If the rule action is “redirect” (step 406), the virtual file nameprovided in the request is mapped to a literal file name according tothe applicable rule (step 408). A request to open the literal fileidentified by the literal file name is passed to the operating systemand the result from the operating system is returned to the requestor(step 410). For example, a request to open a file named “file_(—)1” mayresult in the opening of a literal file named “Different_file_(—)1”. Inone embodiment, this is accomplished by calling the original version ofthe hooked function and passing the formed literal name to the functionas an argument. For embodiments using a file system filter driver, thefirst request to open the file using the virtual name results in thereturn of a STATUS_REPARSE response from the file system filter driverindicating the determined literal name. The I/O Manager then reissuesthe file open request with the determined literal name include in theSTATUS_REPARSE response.

If instead the rule action is “ignore” (step 406), then the literal filename is determined to be exactly the virtual file name (step 412), andthe request to open the literal file is passed to the operating systemand the result from the operating system is returned to the requestor(step 410). For example, a request to open a file named “file_(—)1” willresult in the opening of an actual file named “file_(—)1”. In oneembodiment, this is accomplished by calling the original version of thehooked function and passing the formed literal name to the function asan argument.

If in step 406 the rule action is “isolate”, then the user-scoped filename corresponding to the virtual file name is identified as thecandidate file name (step 414). In other words, the candidate file nameis formed by mapping the virtual file name to the corresponding nativefile name specific to the applicable user isolation scope. For example,a request to open a file named “file_(—)1” may result in the opening ofan actual file named “Isolated_file_(—)1”. In one embodiment, this isaccomplished by calling the original version of the hooked function andpassing the formed literal name to the function as an argument. Forembodiments using a file system filter driver, the first request to openthe file using the virtual name results in the return of aSTATUS_REPARSE response from the file system filter driver indicatingthe determined literal name. The I/O Manager then reissues the file openrequest with the determined literal name include in the REPARSEresponse.

In some embodiments, the literal name formed in order to isolate arequested system file may be based on the virtual file name received anda scope-specific identifier. The scope-specific identifier may be anidentifier associated with an application isolation scope, a userisolation scope, a session isolation scope, an application isolationsub-scope, a user isolation sub-scope, or some combination of the above.The scope-specific identifier is used to “mangle” the virtual namereceived in the request.

In other embodiments, the user isolation scope or a sub-scope may be adirectory under which all files that exist in the user isolation scopeare stored. In some of these embodiments, the directory tree structureunder the user isolation directory reflects the path of the requestedresource. In other words, the literal file path is formed by mapping thevirtual file path to the user isolation scope. For example, if therequested file is c:\temp\test.txt and the user isolation scopedirectory is d:\user1\app1\, then the path to the user-scoped literalfile may be d:\user1\app1\c\temp\test.txt. In other embodiments, thepath to the user-scoped literal may be defined in a native namingconvention. For example, the path to the user-scoped literal file may bed:\user1\app1\device\harddisk1\temp\test.txt. In still otherembodiments, the user-scoped files may all be stored in a singledirectory with names chosen to be unique and a database may be used tostore the mapping between the requested file name and the name of thecorresponding literal file stored in the directory. In still otherembodiments, the contents of the literal files may be stored in adatabase. In still other embodiments, the native file system providesthe facility for a single file to contain multiple independent named“streams”, and the contents of the user-scoped files are stored asadditional streams of the associated files in the system scope.Alternatively, the literal files may be stored in a custom file systemthat may be designed to optimize disk usage or other criteria ofinterest.

The category of existence of the candidate file is determined byexamining the user isolation scope and any metadata associated with thecandidate file (step 416). If the candidate file is determined to have“negative existence”, because either the candidate file or one of itsancestor directories in the user isolation scope is marked as deleted,this means the requested virtual file is known to not exist. In thiscase, an error condition indicating the requested file is not found isreturned to the requestor (step 422).

In some embodiments, small amounts of metadata about a file may bestored directly in the literal filename, such as by suffixing thevirtual name with a metadata indicator, where a metadata indicator is astring uniquely associated with a particular metadata state. Themetadata indicator may indicate or encode one or several bits ofmetadata. Requests to access the file by virtual filename check forpossible variations of the literal filename due to the presence of ametadata indicator, and requests to retrieve the name of the file itselfare hooked or intercepted in order to respond with the literal name. Inother embodiments, one or more alternate names for the file may beformed from the virtual file name and a metadata indicator, and may becreated using hard link or soft link facilities provided by the filesystem. The existence of these links may be hidden from applications bythe isolation environment by indicating that the file is not found if arequest is given to access a file using the name of a link. A particularlink's presence or absence may indicate one bit of metadata for eachmetadata indicator, or there may be a link with a metadata indicatorthat can take on multiple states to indicate several bits of metadata.In still other embodiments, where the file system supports alternatefile streams, an alternate file stream may be created to embodymetadata, with the size of the stream indicating several bits ofmetadata. In still other embodiments, a file system may directly providethe ability to store some 3rd party metadata for each file in the filesystem.

In specific ones of these embodiments, a list of deleted files or filesystem elements may be maintained and consulted to optimize this checkfor deleted files. In these embodiments, if a deleted file is recreatedthen the file name may be removed from the list of deleted files. Inothers of these embodiments, a file name may be removed from the list ifthe list grows beyond a certain size.

If instead in step 416 the candidate file is determined to have“positive existence”, because the candidate file exists in the userisolation scope and is not marked as a placeholder node, then therequested virtual file is known to exist. The candidate file isidentified as the literal file for the request (step 418), and a requestissued to open the literal file and the result returned to the requestor(step 420).

If, however, in step 416, the candidate file has “neutral existence”because the candidate file does not exist, or the candidate file existsbut is marked as a placeholder node, it is not yet known whether thevirtual file exists or not. In this case the application-scoped filename corresponding to the virtual file name is identified as thecandidate file name (step 424). In other words, the candidate file nameis formed by mapping the virtual file name to the corresponding nativefile name specific to the applicable application isolation scope. Thecategory of existence of the candidate file is determined by examiningthe application isolation scope and any metadata associated with thecandidate file (step 426).

If the application-scoped candidate file is determined to have “negativeexistence”, because either the candidate file or one of its ancestordirectories in the application isolation scope is marked as deleted,this means the requested virtual file is known to not exist. In thiscase, an error condition indicating the requested file is not found isreturned to the requestor (step 422).

If in step 426 the candidate file is determined to have “positiveexistence”, because the candidate file exists in the applicationisolation scope and is not marked as a placeholder node, then therequested virtual file is known to exist. The request is checked todetermine if the open request indicates an intention to modify the file(step 428). If not, the candidate file is identified as the literal filefor the request (step 418), and a request issued to open the literalfile and the result returned to the requestor (step 420).

If, however, in step 428, it is determined that the open requestindicates intention to modify the file, permission data associated withthe file is checked to determine if modification of the file is allowed(step 436). In some embodiments, the permission data is associated withthe application-scoped candidate file. In some of these embodiments, thepermissions data is stored in a rules engine or in metadata associatedwith the candidate file. In other embodiments, the permission dataassociated with the candidate file is provided by the operating system.Further, the rules engine may include configuration settings instructingthe isolation environment to obey or override the native permission datafor virtualized copies of resources. In some embodiments, the rules mayspecify for some virtual resources the scope in which modifications areto occur, for example the system scope or the application isolationscope or a sub-scope, or the user isolation scope or a sub-scope. Insome embodiments, the rules engine may specify configuration settingsthat apply to subsets of the virtualized native resources based onhierarchy or on type of resource accessed. In some of these embodiments,the configuration settings may be specific to each atomic nativeresource. In another example, the rules engine may include configurationdata that prohibits or allows modification of certain classes of files,such as executable code or MIME types or file types as defined by theoperating system.

If the permission data associated with the candidate file indicates thatit may not be modified, an error condition is returned to the requestor(step 438) indicating that modification of the file is not allowed. Ifthe permission data indicates that the file may be modified, thecandidate file is copied to the user isolation scope (step 440). In someembodiments, the candidate file is copied to a location defined by therules engine. For example, a rule may specify that the file is copied toanother application isolation scope. In other embodiments the rules mayspecify a particular application isolation sub-scope or user isolationsub-scope to which the file should be copied. Any ancestors of therequested file that do not appear in the isolation scope to which thefile is copied are created as placeholders in the isolation scope inorder to correctly locate the copied instance in the hierarchy.

In some embodiments, metadata is associated with files copied to theisolation scope that identifies the date and time at which the fileswere copied. This information may be used to compare the time stampassociated with the copied instance of the file to the time stamp of thelast modification of the original instance of the file or of anotherinstance of the file located in a lower isolation scope. In theseembodiments, if the original instance of the file, or an instance of thefile located in a lower isolation scope, is associated with a time stampthat is later than the time stamp of the copied file, that file may becopied to the isolation scope to update the candidate file. In otherembodiments, the copy of the file in the isolation scope may beassociated with metadata identifying the scope containing the originalfile that was copied.

In further embodiments, files that are copied to isolation scopesbecause they have been opened with intent to modify them may bemonitored to determine if they are, in fact, modified. In one embodimenta copied file may be associated with a flag that is set when the file isactually modified. In these embodiments, if a copied file is notactually modified, it may be removed from the scope to which it wascopied after it is closed, as well as any placeholder nodes associatedwith the copied file.

The scoped instance is identified as the literal file (step 442) and arequest issued to open the literal file and the result returned to therequestor (step 420).

Returning to step 426, if the candidate file has neutral existencebecause the candidate file does not exist, or if the candidate file isfound but marked as a placeholder node, it is not yet known whether thevirtual file exists or not. In this case, the system-scoped file namecorresponding to the virtual file name is identified as the candidatefile name (step 430). In other words, the candidate file name is exactlythe virtual file name.

If the candidate file does not exist (step 432), an error conditionindicating the virtual file was not found is returned to the requestor(step 434). If on the other hand the candidate file exists (step 432),the request is checked to determine if the open request indicates anintention to modify the file (step 428).

As above, if the candidate file is being opened without the intent tomodify it, the system-scoped candidate file is identified as the literalfile for the request (step 418), and a request issued to open theliteral file and the result returned to the requestor (step 420). If,however, in step 428, it is determined that the open request indicatesintention to modify the file, permission data associated with the fileis checked to determine if modification of the file is allowed (step436). In some embodiments, the permission data is associated with thesystem-scoped candidate file. In some of these embodiments, thepermissions data is stored in a rules engine or in metadata associatedwith the candidate file. In other embodiments, the permission dataassociated with the candidate file is provided by the operating system.

If the permission data associated with the system-scoped candidate fileindicates that the file may not be modified, an error condition isreturned to the requestor (step 438) indicating that modification of thefile is not allowed. If, however, the permission data indicates that thefile may be modified, the candidate file is copied to the user isolationscope (step 440). In some embodiments, the candidate file is copied to alocation defined by the rules engine. For example, a rule may specifythat the file is copied to an application isolation scope or that it maybe left in the system scope. In other embodiments the rules may specifya particular application isolation sub-scope or user isolation sub-scopeto which the file should be copied. Any ancestors of the requested filethat do not appear in the isolation scope are created as placeholders inthe isolation scope in order to correctly locate the copied instance inthe hierarchy.

In some embodiments, metadata is associated with files copied to theisolation scope that identifies the date and time at which the fileswere copied. This information may be used to compare the time stampassociated with the copied instance of the file to the time stamp of thelast modification of the original instance of the file. In theseembodiments, if the original instance of the file is associated with atime stamp that is later than the time stamp of the copied file, theoriginal file may be copied to the isolation scope to update thecandidate file. In other embodiments, the candidate file copied to theisolation scope may be associated with metadata identifying the scopefrom which the original file was copied.

In further embodiments, files that are copied to isolation scopesbecause they have been opened with intent to modify them may bemonitored to determine if they are, in fact, modified. In one embodimenta copied file may be associated with a flag that is set when the file isactually modified. In these embodiments, if a copied file is notactually modified, when it is closed it may be removed from the scope towhich it was copied, as well as any placeholder nodes associated withthe copied file. In still further embodiments, the file is only copiedto the appropriate isolation scope when the file is actually modified.

The scoped instance is identified as the literal file (step 442) and arequest issued to open the literal file and the result returned to therequestor (step 420).

4.1.2 File System Delete Operations

Referring now to FIG. 5, and in brief overview, one embodiment of thesteps taken to delete a file is depicted. A request to delete a file isreceived or intercepted (step 502). The request contains a file name,which is treated as a virtual file name by the isolation environment. Arule determines how the file operation is processed (step 504). If therule action is “redirect” (step 506), the virtual file name is mappeddirectly to a literal file name according to the rule (step 508). Arequest to delete the literal file is passed to the operating system andthe result from the operating system is returned to the requestor (step510). If the rule action is “ignore” (step 506), then the literal filename is identified as exactly the virtual file name (step 513), and arequest to delete the literal file is passed to the operating system andthe result from the operating system is returned to the requestor (step510). If the rule action is “isolate” (step 506), then the existence ofthe virtual file is determined (step 514). If the virtual file does notexist, an error condition is returned to the requestor indicating thatthe virtual file does not exist (step 516). If the virtual file exists,and if the virtualized file specifies a directory rather than anordinary file, the virtual directory is consulted to determine if itcontains any virtual files or virtual subdirectories (step 518). If therequested virtualized file is a virtual directory that contains anyvirtual files or virtual subdirectories, the virtual directory cannot bedeleted and an error message is returned (step 520). If the requestedvirtualized file is an ordinary file or is a virtual directory thatcontains no virtual files and no virtual subdirectories, then theliteral file corresponding to the virtual file is identified (step 522).Permission data associated with the file is checked to determine ifdeletion is allowed (step 524). If not, a permission error message isreturned (step 526). If, however, deletion of the file is allowed, andif the literal file is in the appropriate user isolation scope (step528), the literal file is deleted (step 534) and a “deleted” noderepresenting the deleted virtual file is created in the appropriate userisolation scope (step 536). If, however, in step 528 it is determinedthat the literal file is not in the user isolation scope but is in theappropriate application isolation scope or the system scope, then aninstance of every user-scoped ancestor of the user-scoped instance ofthe requested file that does not already exist is created and marked asa placeholder (step 532). This is done to maintain the logical hierarchyof the directory structure in the user isolation scope. A user-scoped“deleted” node representing the deleted virtual file is then created inthe appropriate user isolation scope (step 536).

Still referring to FIG. 5, and in more detail, a request to delete afile is received or intercepted (step 502). The file may be of userisolation scope, application isolation scope, system scope, or someapplicable isolation sub-scope. In some embodiments, the request ishooked by a function that replaces the operating system function orfunctions for deleting the file. In another embodiment a hookingdynamically-linked library is used to intercept the request. The hookingfunction may execute in user mode or in kernel mode. For embodiments inwhich the hooking function executes in user mode, the hooking functionmay be loaded into the address space of a process when that process iscreated. For embodiments in which the hooking function executes inkernel mode, the hooking function may be associated with an operatingsystem resource that is used in dispatching requests for native files.For embodiments in which a separate operating system function isprovided for each type of file, each function may be hooked separately.Alternatively, a single hooking function may be provided whichintercepts create or open calls for several types of files.

The request contains a file name, which is treated as a virtual filename by the isolation environment. A processing rule applicable to thedelete operation is determined (step 504) by consulting the rulesengine. In some embodiments, the virtual file name provided for therequested file is used to locate in the rule engine a rule that appliesto the request. In particular ones of these embodiments, multiple rulesmay exist in the rules engine for a particular file and, in theseembodiments, the rule having the longest prefix match with the virtualfile name is the rule applied to the request. In some embodiments, therules engine may be provided as a relational database. In otherembodiments, the rules engine may be a tree-structured database, a hashtable, or a flat file database. In some embodiments, the virtual filename provided in the request is used as an index into a rules engine tolocate one or more rules that apply to the request. In otherembodiments, a process identifier is used to locate in the rule engine arule that applies to the request, if one exists. The rule associatedwith a request may be to ignore the request, redirect the request, orisolate the request. Although shown in FIG. 5 as a series of decisions,the rule lookup may occur as a single database transaction.

If the rule action is “redirect” (step 506), the virtual file name ismapped directly to a literal file name according to the applicable rule(step 508). A request to delete the literal file is passed to theoperating system and the result from the operating system is returned tothe requestor (step 510). For example, a request to delete a file named“file_(—)1” may result in the deletion of an actual file named“Different_file_(—)1”. In one embodiment, this is accomplished bycalling the original version of the hooked function and passing theformed literal name to the function as an argument. For embodimentsusing a file system filter driver, the first request to delete the fileusing the virtual name results in the return of a STATUS_REPARSEresponse from the file system filter driver indicating the determinedliteral name. The I/O Manager then reissues the file delete request withthe determined literal name include in the STATUS_REPARSE response.

In some embodiments, operating system permissions associated with theliteral file “Different_file_(—)1” may prevent deletion of the literalfile. In these embodiments, an error message is returned that the filecould not be deleted.

If the rule action is “ignore” (step 506), then the literal file name isidentified as exactly the virtual file name (step 513), and a request todelete the literal file is passed to the operating system and the resultfrom the operating system is returned to the requestor (step 510). Forexample, a request to delete a file named “file_(—)1” will result in thedeletion of an actual file named “file_(—)1”. In one embodiment, this isaccomplished by calling the original version of the hooked function andpassing the formed literal name to the function as an argument. Forembodiments using a file system filter driver, the first request todelete the file using the virtual name results in the return of aSTATUS_REPARSE response from the file system filter driver indicatingthe literal name. The I/O Manager then reissues the file delete requestwith the determined literal name include in the STATUS_REPARSE response.

In some embodiments, operating system permissions associated with theliteral file “file_(—)1” may prevent deletion of the literal file. Inthese embodiments, an error message is returned that the file could notbe deleted.

If the rule action is “isolate” (step 506), then the existence of thevirtual file is determined (step 514). If the file does not exist, anerror is returned indicating that the file is not found (step 516).

If, however, in step 518 it is determined that the file exists but thatit is not an ordinary file and is not an empty virtual directory, i.e.,it contains virtual files or virtual subdirectories, an error message isreturned indicating that the file may not be deleted (step 520).

If, however, the file is determined to exist and the requestedvirtualized file is an ordinary file or is an empty virtual directory,i.e., it contains no virtual files and no virtual subdirectories (step518), then the literal file corresponding to the virtual file isidentified (step 522). The literal file name is determined from thevirtual file name as specified by the isolation rule. For example, arequest to delete a file named “file_(—)1” may result in the deletion ofan actual file named “Isolated_file_(—)1”. In one embodiment, this isaccomplished by calling the original version of the hooked function andpassing the formed literal name to the function as an argument. Forembodiments using a file system filter driver, the first request todelete the file using the virtual name results in the return of aSTATUS_REPARSE response from the file system filter driver indicatingthe literal name. The I/O Manager then reissues the file delete requestwith the determined literal name include in the STATUS_REPARSE response.

Once the literal file corresponding the virtual file is identified, itis determined whether the literal file may be deleted (step 524). If thefile may not be deleted, an error is returned indicating that the filecould not be deleted (step 524). In some embodiments, the permissiondata is associated with the system-scoped candidate file. In some ofthese embodiments, the permissions data is stored in a rules engine orin metadata associated with the candidate file. In other embodiments,the permission data associated with the candidate file is provided bythe operating system.

If, however, deletion of the file is allowed, and if the literal file isin the appropriate user isolation scope (step 528), the literal file isdeleted (step 534) and a “deleted” node representing the deleted virtualfile is created in the appropriate user isolation scope (step 536).

If, however, in step 528 it is determined that the literal file is notin the user isolation scope but is in the appropriate applicationisolation scope or the system scope, then an instance of everyuser-scoped ancestor of the user-scoped instance of the requested filethat does not already exist is created and marked as a placeholder (step532). This is done to maintain the logical hierarchy of the directorystructure in the user isolation scope. A user-scoped “deleted” noderepresenting the deleted virtual file is then created in the appropriateuser isolation scope (step 536). In some embodiments, the identity ofthe deleted file is stored in a file or other cache memory to optimizechecks for deleted files.

In some embodiments, the located virtualized file may be associated withmetadata indicating that the virtualized file has already been deleted.In some other embodiments, an ancestor of the virtualized file (e.g., ahigher directory containing the file) is associated with metadataindicating that it is deleted. In these embodiments, an error messagemay be returned indicating that the virtualized file does not exist. Inspecific ones of these embodiments, a list of deleted files or filesystem elements may be maintained and consulted to optimize this checkfor deleted files.

4.1.3 File System Enumeration Operations

Referring now to FIG. 6, and in brief overview, one embodiment of thesteps taken to enumerate a directory in the described virtualizedenvironment is shown. A request to enumerate is received or intercepted(step 602). The request contains a directory name that is treated as avirtual directory name by the isolation environment. Conceptually, thevirtual directory's existence is determined as described in section4.1.1 (step 603). If the virtual directory does not exist, a resultindicating that the virtual directory is not found is returned to therequestor (step 620). If instead the virtual directory exists, the rulesengine is consulted to determine the rule for the directory specified inthe enumerate request (step 604). If the rule specifies an action of“redirect” (step 606), the literal directory name corresponding to thevirtual directory name is determined as specified by the rule (step 608)and the literal directory identified by the literal name is enumerated,and the enumeration results stored in a working data store (step 612),followed by step 630 as described later. If the rule action specified isnot “redirect” and is “ignore,” (step 610) the literal directory name isexactly the virtual directory name (step 613) and the literal directoryis enumerated, and the enumeration results stored in a working datastore (step 612), followed by step 630 as described later. If, however,the rule action specifies “isolate,” firstly the system scope isenumerated; that is, the candidate directory name is exactly the virtualdirectory name, and if the candidate directory exists it is enumerated.The enumeration results are stored in a working data store. If thecandidate directory does not exist, the working data store remains emptyat this stage (step 614). Next, the candidate directory is identified asthe application-scoped instance of the virtual directory, and thecategory of existence of the candidate directory is determined (step615). If the candidate directory has “negative existence”, i.e. it orone of its ancestors in the scope is marked as deleted, then within thisscope it is known to be deleted, and this is indicated by flushing theworking data store (step 642). If instead the candidate directory doesnot have negative existence, the candidate directory is enumerated andany enumeration results obtained are merged into the working data store.In particular, for each file system element in the enumeration, itscategory of existence is determined. Elements with negative existenceare removed from the working data store, and elements with positiveexistence, i.e. those that exist and are not marked as placeholders andare not marked as deleted, are added to the working data store,replacing the corresponding element if one is already present in theworking data store (step 616).

In either case, the candidate directory is identified as the user-scopedinstance of the virtual directory, and the category of existence of thecandidate directory is determined (step 617). If the candidate directoryhas “negative existence”, i.e. it or one of its ancestors in the scopeis marked as deleted, then within this scope it is known to be deleted,and this is indicated by flushing the working data store (step 644). Ifinstead the candidate directory does not have negative existence, thecandidate directory is enumerated and any enumeration results obtainedare merged into the working data store. In particular, for each filesystem element in the enumeration, its category of existence isdetermined. Elements with negative existence are removed from theworking data store, and elements with positive existence, i.e. thosethat exist and are not marked as placeholders and are not marked asdeleted, are added to the working data store, replacing thecorresponding element if one is already present in the working datastore (step 618), followed by step 630 as described below.

Then, for all three types of rules, step 630 is executed. The rulesengine is queried to find the set of rules whose filters match immediatechildren of the requested directory, but do not match the requesteddirectory itself (step 630). For each rule in the set, the existence ofthe virtual child whose name matches the name in the rule is queriedusing the logic outlined in section 4.1.1. If the child has positiveexistence, it is added to the working data store, replacing any child ofthe same name already there. If the child has negative existence, theentry in the working data store corresponding to the child, if any, isremoved. (Step 632). Finally, the constructed enumeration is thenreturned from the working data store to the requestor (step 620).

Still referring to FIG. 6, and in more detail, a request to enumerate adirectory is received or intercepted (step 602). In some embodiments,the request is hooked by a function that replaces the operating systemfunction or functions for enumerating a directory. In anotherembodiment, a hooking dynamically-linked library is used to interceptthe request. The hooking function may execute in user mode or in kernelmode. For embodiments in which the hooking function executes in usermode, the hooking function may be loaded into the address space of aprocess when that process is created. For embodiments in which thehooking function executes in kernel mode, the hooking function may beassociated with an operating system resource that is used in dispatchingrequests for file operations. For embodiments in which a separateoperating system function is provided for each type of file operation,each function may be hooked separately. Alternatively, a single hookingfunction may be provided which intercepts create or open calls forseveral types of file operations.

The existence of the virtual directory is determined (step 603). This isachieved as described in section 4.1.1. If the virtual directory doesnot exist, it cannot be enumerated, and a result indicating that thevirtual directory does not exist is returned to the requestor (step620).

The request contains a directory name, which is treated as a virtualdirectory name by the isolation environment. If the virtual directoryexists, then a rule determining how the enumeration operation is to beprocessed is located (step 604) by consulting the rules engine. In someembodiments, the rules engine may be provided as a relational database.In other embodiments, the rules engine may be a tree-structureddatabase, a hash table, or a flat file database. In some embodiments,the virtual directory name provided for the requested directory is usedto locate in the rule engine a rule that applies to the request. Inparticular ones of these embodiments, multiple rules may exist in therules engine for a particular directory and, in these embodiments, therule having the longest prefix match with the virtual directory name isthe rule applied to the request. In other embodiments, a processidentifier is used to locate in the rule engine a rule that applies tothe request, if one exists. The rule associated with a request may be toignore the request, redirect the request, or isolate the request.Although shown in FIG. 6 as a single database transaction or singlelookup into a file, the rule lookup may be performed as a series of rulelookups.

If the rule action is “redirect” (step 606), the virtual directory nameis mapped directly to a literal directory name according to the rule(step 608). A request to enumerate the literal directory is passed tothe operating system (step 612) and step 630 is executed as describedlater. For example, a request to enumerate a directory named“directory_(—)1” may result in the enumeration of a literal directorynamed “Different_directory_(—)1”. In one embodiment, this isaccomplished by calling the original version of the hooked function andpassing the formed literal name to the function as an argument. Forembodiments using a file system filter driver, the first request to openthe directory for enumeration using the virtual name results in a“STATUS_REPARSE” request response indicating the determined literalname. The I/O Manager then reissues the directory open request forenumeration with the determined literal name include in theSTATUS_REPARSE response.

If the rule action is not “redirect” (step 606), but is “ignore” (step610), then the literal directory name is identified as exactly thevirtual directory name (step 613), and a request to enumerate theliteral directory is passed to the operating system (step 612) and step630 is executed as described later. For example, a request to enumeratea directory named “directory_(—)1” will result in the enumeration of anactual directory named “directory_(—)1.” In one embodiment, this isaccomplished by calling the original version of the hooked function andpassing the formed literal name to the function as an argument. Forembodiments using a file system filter driver, the first request toenumerate the directory using the virtual name is passed on unmodifiedby the filter driver.

If the rule action determined in step 610 is not “ignore” but is“isolate”, then the system scope is enumerated, that is, the virtualname provided in the request is used to identify the enumerateddirectory (step 614). The results of the enumeration are stored in aworking data store. In some embodiments, the working data store iscomprised of a memory element. In other embodiments, the working datastore comprises a database or a file or a solid-state memory element ora persistent data store.

Next, the candidate directory is identified as the application-scopedinstance of the virtual directory, and the category of existence of thecandidate directory is determined (step 615). If the candidate directoryhas “negative existence”, i.e. it or one of its ancestors in the scopeis marked as deleted, then within this scope it is known to be deleted,and this is indicated by flushing the working data store (step 642).

In some embodiments, small amounts of metadata about a file may bestored directly in the literal filename, such as by suffixing thevirtual name with a metadata indicator, where a metadata indicator is astring uniquely associated with a particular metadata state. Themetadata indicator may indicate or encode one or several bits ofmetadata. Requests to access the file by virtual filename check forpossible variations of the literal filename due to the presence of ametadata indicator, and requests to retrieve the name of the file itselfare hooked or intercepted in order to respond with the literal name. Inother embodiments, one or more alternate names for the file may beformed from the virtual file name and a metadata indicator, and may becreated using hard link or soft link facilities provided by the filesystem. The existence of these links may be hidden from applications bythe isolation environment by indicating that the file is not found if arequest is given to access a file using the name of a link. A particularlink's presence or absence may indicate one bit of metadata for eachmetadata indicator, or there may be a link with a metadata indicatorthat can take on multiple states to indicate several bits of metadata.In still other embodiments, where the file system supports alternatefile streams, an alternate file stream may be created to embodymetadata, with the size of the stream indicating several bits ofmetadata. In still other embodiments, a file system may directly providethe ability to store some 3rd party metadata for each file in the filesystem. In yet other embodiment, a separate sub-scope may be used torecord deleted files, and existence of a file (not marked as aplaceholder) in that sub-scope is taken to mean that the file isdeleted.

If instead the candidate directory does not have negative existence, thecandidate directory is enumerated and any enumeration results obtainedare merged into the working data store. In particular, for each filesystem element in the enumeration, its category of existence isdetermined. Elements with negative existence are removed from theworking data store, and elements with positive existence, i.e. thosethat exist and are not marked as placeholders and are not marked asdeleted, are added to the working data store, replacing thecorresponding element if one is already present in the working datastore (step 616).

In either case, the candidate directory is identified as the user-scopedinstance of the virtual directory, and the category of existence of thecandidate directory is determined (step 617). If the candidate directoryhas “negative existence”, i.e. it or one of its ancestors in the scopeis marked as deleted, then within this scope it is known to be deleted,and this is indicated by flushing the working data store (step 644). Ifinstead the candidate directory does not have negative existence, thecandidate directory is enumerated and any enumeration results obtainedare merged into the working data store. In particular, for each filesystem element in the enumeration, its category of existence isdetermined. Elements with negative existence are removed from theworking data store, and elements with positive existence, i.e. thosethat exist and are not marked as placeholders and are not marked asdeleted, are added to the working data store, replacing thecorresponding element if one is already present in the working datastore (step 618), followed by step 630 as described below.

Then, for all three types of rules, step 630 is executed. The rulesengine is queried to find the set of rules whose filters match immediatechildren of the requested directory, but do not match the requesteddirectory itself (step 630). For each rule in the set, the existence ofthe virtual child whose name matches the name in the rule is queriedusing the logic outlined in section 4.1.1. If the child has positiveexistence, it is added to the working data store, replacing any child ofthe same name already there. If the child has negative existence, theentry in the working data store corresponding to the child, if any, isremoved. (Step 632). Finally, the constructed enumeration is thenreturned from the working data store to the requestor (step 620).

A practitioner of ordinary skill in the art will realize that thelayered enumeration process described above can be applied with minormodification to the operation of enumerating a single isolation scopewhich comprises a plurality of isolation sub-scopes. A working datastore is created, successive sub-scopes are enumerated and the resultsare merged into the working data store to form the aggregatedenumeration of the isolation scope.

4.1.4. File System Creation Operations

Referring now to FIG. 7, and in brief overview, one embodiment of thesteps taken to create a file in the isolation environment is shown. Arequest to create a file is received or intercepted (step 702). Therequest contains a file name, which is treated as a virtual file name bythe isolation environment. An attempt is made to open the requested fileusing full virtualization using applicable rules, i.e. using appropriateuser and application isolation scope, as described in section 4.1.1(step 704). If access is denied (step 706), an access denied error isreturned to the requestor (step 709). If access is granted (step 706),and the requested file is successfully opened (step 710), the requestedfile is returned to the requestor (step 712). However, if access isgranted (step 706), but the requested file is not opened successfully(step 710) then if the parent of the requested file also does not exist(step 714), an error appropriate to the request semantics is issued tothe requestor (step 716). If on the other hand, the parent of therequested file is found in full virtualized view using the appropriateuser and application scope (step 714), a rule then determines how thefile operation is processed (step 718). If the rule action is “redirect”or “ignore” (step 720), the virtual file name is mapped directly to aliteral file name according to the rule. Specifically, if the ruleaction is “ignore”, the literal file name is identified as exactly thevirtual file name. If, instead, the rule action is “redirect”, theliteral file name is determined from the virtual file name as specifiedby the rule. Then a request to create the literal file is passed to theoperating system, and the result is returned to the requestor (step724). If on the other hand, the rule action determined in step 720 is“isolate”, then the literal file name is identified as the instance ofthe virtual file name in the user isolation scope. If the literal filealready exists, but is associated with metadata indicating that it is aplaceholder or that it is deleted, then the associated metadata ismodified to remove those indications, and it is ensured that the file isempty. In either case, a request to open the literal file is passed tothe operating system (step 726). If the literal file was openedsuccessfully (step 728), the literal file is returned to the requestor(step 730). If on the other hand, in step 728, the requested file failsto open, placeholders for each ancestor of the literal file that doesnot currently exist in the user-isolation scope (step 732) and a requestto create the literal file using the literal name is passed to theoperating system and the result is returned to the requestor (step 734).

Still referring to FIG. 7, and in more detail, a request to create afile is received or intercepted (step 702). In some embodiments, therequest is hooked by a function that replaces the operating systemfunction or functions for creating the file. In another embodiment, ahooking dynamically-linked library is used to intercept the request. Thehooking function may execute in user mode or in kernel mode. Forembodiments in which the hooking function executes in user mode, thehooking function may be loaded into the address space of a process whenthat process is created. For embodiments in which the hooking functionexecutes in kernel mode, the hooking function may be associated with anoperating system resource that is used in dispatching requests forfiles. For embodiments in which a separate operating system function isprovided for each type of file operation, each function may be hookedseparately. Alternatively, a single hooking function may be providedwhich intercepts create or open calls for several types of fileoperations.

The request contains a file name, which is treated as a virtual filename by the isolation environment. The requestor attempts to open therequested file using full virtualization using applicable rules, i.e.using appropriate user and application isolation scope, as described insection 4.1.1 (step 704). If access is denied during the fullvirtualized open operation (step 706), an access denied error isreturned to the requestor (step 709). If access is granted (step 706),and the requested virtual file is successfully opened (step 710), thecorresponding literal file is returned to the requestor (step 712).However, if access is granted (step 706), but the requested file is notopened successfully (step 710) then the virtual file has been determinednot to exist. If the virtual parent of the requested virtual file alsodoes not exist, as determined by the procedures in section 4.1.1 (step714), an error appropriate to the request semantics is issued to therequestor (step 716). If on the other hand, the virtual parent of therequested virtual file is found in full virtualized view using theappropriate user and application scope (step 714), then a rule thatdetermines how the create operation is processed is located (step 718)by consulting the rules engine. In some embodiments, the rules enginemay be provided as a relational database. In other embodiments, therules engine may be a tree-structured database, a hash table, or a flatfile database. In some embodiments, the virtual file name provided forthe requested file is used to locate in the rule engine a rule thatapplies to the request. In particular ones of these embodiments,multiple rules may exist in the rules engine for a particular file and,in some of these embodiments, the rule having the longest prefix matchwith the virtual file name is the rule applied to the request. In someembodiments, a process identifier is used to locate in the rule engine arule that applies to the request, if one exists. The rule associatedwith a request may be to ignore the request, redirect the request, orisolate the request. Although shown in FIG. 7 as a single databasetransaction or single lookup into a file, the rule lookup may beperformed as a series of rule lookups.

If the rule action is “redirect” or “ignore” (step 720), the virtualfile name is mapped directly to a literal file name according to therule (step 724). If the rule action is “redirect” (step 720), theliteral file name is determined from the virtual file name as specifiedby the rule (step 724). If the rule action is “ignore” (step 720), theliteral file name is determined to be exactly the virtual file name(step 724). If the rule action is “ignore” or the rule action is“redirect”, a request to create the literal file using the determinedliteral file name is passed to the operating system and the result fromthe operating system is returned to the requestor (step 724). Forexample, a request to create a virtual file named “file_1” may result inthe creation of a literal file named “Different _file_1.” In oneembodiment, this is accomplished by calling the original version of thehooked function and passing the formed literal name to the function asan argument. (step 724). For embodiments using a file system filterdriver, the first request to open the file using the virtual nameresults in a “STATUS_REPARSE” request response that indicates thedetermined literal name. The I/O Manager then reissues the file openrequest with the determined literal name include in the STATUS_REPARSEresponse.

If the rule action determined in step 720 is not “ignore” or “redirect”but is “isolate,” then the literal file name is identified as theinstance of the virtual file name in the user isolation scope. If theliteral file already exists, but is associated with metadata indicatingthat it is a placeholder or that it is deleted, then the associatedmetadata is modified to remove those indications, and it is ensured thatthe file is empty.

In some embodiments, small amounts of metadata about a file may bestored directly in the literal filename, such as by suffixing thevirtual name with a metadata indicator, where a metadata indicator is astring uniquely associated with a particular metadata state. Themetadata indicator may indicate or encode one or several bits ofmetadata. Requests to access the file by virtual filename check forpossible variations of the literal filename due to the presence of ametadata indicator, and requests to retrieve the name of the file itselfare hooked or intercepted in order to respond with the literal name. Inother embodiments, one or more alternate names for the file may beformed from the virtual file name and a metadata indicator, and may becreated using hard link or soft link facilities provided by the filesystem. The existence of these links may be hidden from applications bythe isolation environment by indicating that the file is not found if arequest is given to access a file using the name of a link. A particularlink's presence or absence may indicate one bit of metadata for eachmetadata indicator, or there may be a link with a metadata indicatorthat can take on multiple states to indicate several bits of metadata.In still other embodiments, where the file system supports alternatefile streams, an alternate file stream may be created to embodymetadata, with the size of the stream indicating several bits ofmetadata. In still other embodiments, a file system may directly providethe ability to store some 3rd party metadata for each file in the filesystem.

In specific ones of these embodiments, a list of deleted files or filesystem elements may be maintained and consulted to optimize this checkfor deleted files. In these embodiments, if a deleted file is recreatedthen the file name may be removed from the list of deleted files. Inothers of these embodiments, a file name may be removed from the list ifthe list grows beyond a certain size.

In either case, a request to open the user-scoped literal file is passedto the operating system (step 726). In some embodiments, rules mayspecify that the literal file corresponding to the virtual file shouldbe created in a scope other than the user isolation scope, such as theapplication isolation scope, the system scope, a user isolationsub-scope or an application isolation sub-scope.

If the literal file was opened successfully (step 728), the literal fileis returned to the requestor (step 730). If on the other hand, in step728, the requested file fails to open, placeholders are created for eachancestor of the literal file that does not currently exist in theuser-isolation scope (step 732) and a request to create the literal fileusing the literal name is passed to the operating system and the resultis returned to the requestor (step 734).

This embodiment is for operating systems with APIs or facilities thatonly support creation of one level per call/invocation. Extension tomulti-levels per call/invocation should be obvious to one skilled in theart.

4.1.5 Short Filename Management

In some file systems, both short and long filenames may be given to eachfile. Either name may be used to access the file in any of the fileoperations described above. For each file that possesses both a shortand long filename, this implicitly creates an association between theshort and long filename assigned to that file. In some of these filesystems, short names are automatically assigned by the file system tofiles that are created using long file names. If the association betweenshort and long filename is not maintained by the isolation environment,files with different long names in the same directory but in differentscope levels may have the same short file name, leading to ambiguity ifthe short name is used to access a virtual file. Alternately, the shortfile name may change when a file is copied to a user isolation scope formodification meaning the virtual file can no longer be accessed usingthe original short name.

In order to prevent these issues, firstly file system operations thatcopy file instances opened with intention to modify to a “higher” scopepreserve the association between the short and long filenames associatedwith the copied instance. Secondly, unique short names are created fornewly-created isolated files in lieu of the filenames assigned by theoperating system. The generated short filenames should satisfy thecondition that the generated filenames do not match any existing shortfilenames in the same directory in the same isolation scope or in thesame directory in a “lower” isolation scope. For example, a shortfilename generated for an instance of a file located in a user isolationscope should not match existing short filenames in application-scopedinstance of the directory or in the system-scoped instance of thedirectory.

Referring now to FIG. 7A, one embodiment of the steps taken to assignunique short filenames after creating a new file is shown. In briefoverview, a check is made to determine if short filenames should begenerated (step 752). If not, a status is returned indicating that noshort filename will be generated (step 754). Otherwise, the filename ischecked to determine if it is already a legal short filename accordingto the file system (step 756). If it is already a legal short filename,a status is returned indicating that no short name will be generated(step 754). Otherwise, a suitable short filename is constructed (step758).

Still referring to FIG. 7A, and in greater detail, a check is made todetermine if short filenames should be generated (step 752). In someembodiments, this decision may be made based on the device storing thefile to which the filename refers. In other embodiments, generation ofshort filenames may be enabled for certain scopes or sub-scopes, or forthe isolation environment as a whole. In some of these embodiments, aregistry setting may specify whether a short filename will be generatedfor a particular filename. If no short filename should be generated, astatus that no short filename will be generated is returned (step 754).

Otherwise, the filename is checked to determine if it is already a legalshort filename (step 756). In some embodiments, legal short filenamescontain up to eight characters in the filename and up to threecharacters in an optional extension. In some embodiments, legal shortnames contain only legal characters, such as A-Z, a-z, 0-9, {grave over( )}, ˜, !, @, #, $, %, ^, &, *, (,), -, _, ', {, and }. In someembodiments a leading space or “.” or more than one embedded “.” isillegal. If the provided filename is already a legal short filename, astatus is returned that no short filename will be generated (step 754).

Otherwise, if it is determined in step 756 that the filename is anillegal short filename, a suitable short filename is constructed (step758). In some embodiments this is achieved by using some of the parts ofthe long filename that are legal to use in a short filename, combinedwith an encoded iteration count to form a candidate short filename. Theiteration count is increased until the associated candidate shortfilename is suitable, that is it is a legal short filename that is notused by any other file in the same directory in the same scope, or inthe same directory in a lower scope. In other embodiments, the longfilename is mangled or hashed and encoded, and is combined with anencoded iteration count to form a candidate short filename. Theiteration count is increased until the associated candidate shortfilename is suitable, that is it is a legal short filename that is notused by any other file in the same directory in the same scope, or inthe same directory in a lower scope. In all of these embodiments ascope-specific string may be incorporated into the candidate shortfilename to increase the likelihood that a suitable candidate shortfilename will be found with a low iteration count.

4.2 Registry Virtualization

The methods and apparatus described above may be used to virtualizeaccess to a registry database. As described above a registry databasestores information regarding hardware physically attached to thecomputer, which system options have been selected, how computer memoryis set up, various items of application-specific data, and whatapplication programs should be present when the operating system isstarted. A registry database is commonly organized in a logicalhierarchy of “keys” 170, 172, which are containers for registry values.

4.2.1 Registry Key Open Operations

In brief overview, FIG. 8 depicts one embodiment of the steps taken toopen a registry key in the isolation environment described above. Arequest to open a registry key is received or intercepted, the requestcontaining a registry key name which is treated as a virtual key name bythe isolation environment (step 802). A processing rule applicable tothe virtual name in the request determines how the registry keyoperation is processed (step 804). If the rule action is “redirect”(step 806), the virtual key name provided in the request is mapped to aliteral key name as specified by the applicable rule (step 808). Arequest to open the literal registry key using the literal key name ispassed to the operating system and the result from the operating systemis returned to the requestor (step 810). If the rule action is not“redirect”, but is “ignore” (step 806), then the virtual key name isidentified as the literal key name (step 812), and a request to open theliteral registry key is passed to the operating system and the resultfrom the operating system is returned to the requestor (step 810). Ifthe rule action determined in step 806 is not “redirect” and is not“ignore,” but is “isolate”, the virtual key name provided in the requestis mapped to a user-scoped candidate key name, that is a key namecorresponding to the virtual key name that is specific to the applicableuser isolation scope (step 814). The category of existence of theuser-scoped candidate key is determined by examining the user isolationscope and any metadata associated with the candidate key (step 816). Ifthe candidate key is determined to have “negative existence”, becauseeither the candidate key or one of its ancestor keys in the userisolation scope is marked as deleted, this means the requested virtualkey is known to not exist. In this case, an error condition indicatingthe requested file is not found is returned to the requestor (step 822).If instead in step 816 the candidate key is determined to have “positiveexistence”, because the candidate key exists in the user isolation scopeand is not marked as a placeholder node, then the requested virtual keyis known to exist. The candidate key is identified as the literal keyfor the request (step 818), and a request issued to open the literal keyand the result returned to the requestor (step 820). If, however, instep 816, the candidate key has “neutral existence” because thecandidate key does not exist, or the candidate key exists but is markedas a placeholder node, it is not yet known whether the virtual keyexists or not. In this case the application-scoped key namecorresponding to the virtual key name is identified as the candidate keyname (step 824). In other words, the candidate key name is formed bymapping the virtual key name to the corresponding native key namespecific to the applicable application isolation scope. The category ofexistence of the candidate key is determined by examining theapplication isolation scope and any metadata associated with thecandidate key (step 826). If the candidate key is determined to have“negative existence”, because either the candidate key or one of itsancestor keys in the application isolation scope is marked as deleted,this means the requested virtual key is known to not exist. In thiscase, an error condition indicating the requested key is not found isreturned to the requestor (step 822). If instead in step 826 thecandidate key is determined to have “positive existence”, because thecandidate key exists in the application isolation scope and is notmarked as a placeholder node, then the requested virtual key is known toexist. The request is checked to determine if the open request indicatesan intention to modify the key (step 828). If not, the candidate key isidentified as the literal key for the request (step 818), and a requestissued to open the literal key and the result returned to the requestor(step 820). If, however, in step 828, it is determined that the openrequest indicates an intention to modify the key, permission dataassociated with the key is checked to determine if modification of thekey is allowed (step 836). If not, an error condition is returned to therequestor (step 838) indicating that modification of the key is notallowed. If the permission data indicates that the key may be modified,the candidate key is copied to the user isolation scope (step 840). Insome embodiments, the candidate key is copied to a location defined bythe rules engine. For example, a rule may specify that the key is copiedto an application isolation scope. In other embodiments the rules mayspecify a particular application isolation sub-scope or user isolationsub-scope to which the key should be copied. Any ancestors of therequested key that do not appear in the isolation scope to which the keyis copied are created as placeholders in the isolation scope in order tocorrectly locate the copied instance in the hierarchy. The newly copiedscoped instance is identified as the literal key (step 842) and arequest issued to open the literal key and the result returned to therequestor (step 820). Returning to step 826, if the candidate key hasneutral existence because the candidate key does not exist, or becausethe candidate key is found but marked as a placeholder node, it is notyet known whether the virtual key exists or not. In this case, thesystem-scoped key name corresponding to the virtual key name isidentified as the candidate key name (step 830). In other words, thecandidate key name is exactly the virtual key name. If the candidate keydoes not exist (step 832), an error condition indicating the virtual keywas not found is returned to the requestor (step 834). If on the otherhand the candidate key exists (step 832), the request is checked todetermine if the open request indicates an intention to modify the key(step 828). If not, the candidate key is identified as the literal keyfor the request (step 818), and a request issued to open the literal keyand the result returned to the requestor (step 820). If, however, instep 828, it is determined that the open request indicates intention tomodify the key, permission data associated with the key is checked todetermine if modification of the key is allowed (step 836). If not, anerror condition is returned to the requestor (step 838) indicating thatmodification of the key is not allowed. If the permission data indicatesthat the key may be modified, the candidate key is copied to the userisolation scope (step 840). In some embodiments, the candidate key iscopied to a location defined by the rules engine. For example, a rulemay specify that the key is copied to an application isolation scope. Inother embodiments the rules may specify a particular applicationisolation sub-scope or user isolation sub-scope to which the key shouldbe copied. Any ancestors of the requested key that do not appear in theisolation scope are created as placeholders in the isolation scope inorder to correctly locate the copied instance in the hierarchy. Thenewly copied scoped instance is identified as the literal key (step 842)and a request issued to open the literal key and the result returned tothe requestor (step 820).

Still referring to FIG. 8 and now in more detail, a request to open avirtual registry key is received or intercepted (step 802). Thecorresponding literal registry key may be of user isolation scope,application isolation scope or system scope, or it may be scoped to anapplication isolation sub-scope or a user isolation sub-scope. In someembodiments, the request is hooked by a function that replaces theoperating system function or functions for opening a registry key. Inanother embodiment a hooking dynamically-linked library is used tointercept the request. The hooking function may execute in user mode orin kernel mode. For embodiments in which the hooking function executesin user mode, the hooking function may be loaded into the address spaceof a process when that process is created. For embodiments in which thehooking function executes in kernel mode, the hooking function may beassociated with an operating system resource that is used in dispatchingrequests for native registry keys. For embodiments in which a separateoperating system function is provided for each type of registry keyoperation, each function may be hooked separately. Alternatively, asingle hooking function may be provided which intercepts create or opencalls for several types of registry key operations.

The request contains a registry key name, which is treated as a virtualregistry key name by the isolation environment. The processing ruleapplicable to the registry key open request is determined (step 804) byconsulting the rules engine. In some embodiments, the rules engine maybe provided as a relational database. In other embodiments, the rulesengine may be a tree-structured database, a hash table, or a flat filedatabase. In some embodiments, the virtual registry key name providedfor the requested registry key is used to locate in the rule engine arule that applies to the request. In particular ones of theseembodiments, multiple rules may exist in the rules engine for aparticular registry key and, in these embodiments, the rule having thelongest prefix match with the virtual registry key name is the ruleapplied to the request. In other embodiments, a process identifier isused to locate in the rule engine a rule that applies to the request, ifone exists. The rule associated with a request may be to ignore therequest, redirect the request, or isolate the request. Although shown inFIG. 8 as a single database transaction or single lookup into a file,the rule lookup may be performed as a series of rule lookups.

If the rule action is “redirect” (step 806), the virtual registry keyname provided in the request is mapped to the literal registry key nameaccording to the applicable rule (step 808). A request to open theliteral registry key using the literal registry key name is passed tothe operating system and the result from the operating system isreturned to the requestor (step 810). For example, a request to open aregistry key named “registry_key_(—)1” may result in the opening of aliteral registry key named “Different _registry_key_(—)1”. In oneembodiment, this is accomplished by calling the original version of thehooked function and passing the formed literal name to the function asan argument. In other embodiments, a registry filter driver facilityconceptually similar to a file system filter driver facility may beprovided by the operating system. In these embodiments, opening theliteral registry key may be achieved by responding to the originalrequest to open the virtual key by signaling to the registry filtermanager to reparse the request using the determined literal key name. Ifinstead the rule action is “ignore” (step 806), then the literalregistry key name is determined to be exactly the virtual registry keyname (step 812), and the request to open the literal registry key ispassed to the operating system and the result from the operating systemis returned to the requestor (step 810). For example, a request to opena registry key named “registry_key_(—)1” will result in the opening of aliteral registry key named “registry_key_(—)1”. In one embodiment, thisis accomplished by calling the original version of the hooked functionand passing the formed literal name to the function as an argument. Inanother embodiment, this is accomplished by signaling to the registryfilter manager to continue processing the original unmodified request inthe normal fashion.

If in step 806 the rule action is “isolate”, then the user-scopedregistry key name corresponding to the virtual registry key name isidentified as the candidate registry key name (step 814). In otherwords, the candidate registry key name is formed by mapping the virtualregistry key name to the corresponding native registry key name specificto the applicable user isolation scope. For example, a request to open aregistry key named “registry_key_(—)1” may result in the opening of aliteral registry key named “Isolated_UserScope_UserA_registry_key_(—)1”.In one embodiment, this is accomplished by calling the original versionof the hooked function and passing the formed literal name to thefunction as an argument. In other embodiments, opening the literalregistry key may be achieved by responding to the original request toopen the virtual key by signaling to the registry filter manager toreparse the request using the determined literal key name.

In some embodiments, the literal name formed in order to isolate arequested virtual registry key may be based on the virtual registry keyname received and a scope-specific identifier. The scope-specificidentifier may be an identifier associated with an application isolationscope, a user isolation scope, a session isolation scope, an applicationisolation sub-scope, a user isolation sub-scope, or some combination ofthe above. The scope-specific identifier is used to “mangle” the virtualname received in the request.

In other embodiments, the user isolation scope or a sub-scope may be aregistry key under which all keys that exist in the user isolation scopeare stored. In some of these embodiments, the key hierarchy under theuser isolation key reflects the path of the requested resource. In otherwords, the literal key path is formed by mapping the virtual key path tothe user isolation scope. For example, if the requested key isHKLM\Software\Citrix\MyKey and the user isolation scope key isHKCU\Software\UserScope\, then the path to the user-scoped literal keymay be HKCU\Software\UserScope\HKLM\Software\Citrix\MyKey. In otherembodiments, the path to the user-scoped literal may be defined in anative naming convention. For example, the path to the user-scopedliteral key may beHKCU\Software\UserScope\Registry\Machine\Software\Citrix\MyKey. In stillother embodiments, the user-scoped keys may all be stored under a singlekey with names chosen to be unique and a database may be used to storethe mapping between the requested key name and the name of thecorresponding literal key stored in the user isolation key. In stillother embodiments, the contents of the literal keys may be stored in adatabase or a file store.

The category of existence of the candidate key is determined byexamining the user isolation scope and any metadata associated with thecandidate key (step 816). If the candidate key is determined to have“negative existence”, because either the candidate key or one of itsancestor keys in the user isolation scope is marked as deleted, thismeans the requested virtual key is known to not exist. In this case, anerror condition indicating the requested key is not found is returned tothe requestor (step 822).

In some embodiments, the literal registry key may be associated withmetadata indicating that the virtualized registry key has already beendeleted. In some embodiments, metadata about a registry key may bestored in a distinguished value held by that key, with the existence ofthat value hidden from ordinary application usage of registry APIs. Insome embodiments, small amounts of metadata about a registry key may bestored directly in the literal key name, such as by suffixing thevirtual name with a metadata indicator, where a metadata indicator is astring uniquely associated with a particular metadata state. Themetadata indicator may indicate or encode one or several bits ofmetadata. Requests to access the key by virtual name check for possiblevariations of the literal key name due to the presence of a metadataindicator, and requests to retrieve the name of the key itself arehooked or intercepted in order to respond with the literal name. Inother embodiments, the metadata indicator may be encoded in a subkeyname or a registry value name instead of the key name itself. In stillother embodiments, a registry key system may directly provide theability to store some 3rd party metadata for each key. In someembodiments, metadata is stored in a database or other repositoryseparate from the registry database. In some embodiments, a separatesub-scope may be used to store keys that are marked as deleted. Theexistence of a key in the sub-scope indicates that the key is marked asdeleted.

In specific ones of these embodiments, a list of deleted keys or keysystem elements may be maintained and consulted to optimize this checkfor deleted keys. In these embodiments, if a deleted key is recreatedthen the key name may be removed from the list of deleted keys. Inothers of these embodiments, a key name may be removed from the list ifthe list grows beyond a certain size.

If instead in step 816 the candidate key is determined to have “positiveexistence”, because the candidate key exists in the user isolation scopeand is not marked as a placeholder node, then the requested virtual keyis known to exist. The candidate key is identified as the literal keyfor the request (step 818), and a request issued to open the literal keyand the result returned to the requestor (step 820).

If, however, in step 816, the candidate key has “neutral existence”because the candidate key does not exist, or the candidate key existsbut is marked as a placeholder node, it is not yet known whether thevirtual key exists or not. In this case the application-scoped key namecorresponding to the virtual key name is identified as the candidate keyname (step 824). In other words, the candidate key name is formed bymapping the virtual key name to the corresponding native key namespecific to the applicable application isolation scope. The category ofexistence of the candidate key is determined by examining theapplication isolation scope and any metadata associated with thecandidate key (step 826).

If the application-scoped candidate key is determined to have “negativeexistence”, because either the candidate key or one of its ancestor keysin the application isolation scope is marked as deleted, this means therequested virtual key is known to not exist. In this case, an errorcondition indicating the requested key is not found is returned to therequestor (step 822).

If, however, in step 826 the candidate key is determined to have“positive existence”, because the candidate key exists in theapplication isolation scope and is not marked as a placeholder node,then the requested virtual key is known to exist. The request is checkedto determine if the open request indicates an intention to modify thekey (step 828). If not, the candidate key is identified as the literalkey for the request (step 818), and a request issued to open the literalkey and the result returned to the requestor (step 820).

If, however, in step 828, it is determined that the open requestindicates intention to modify the key, permission data associated withthe key is checked to determine if modification of the key is allowed(step 836). In some embodiments, the permission data is associated withthe application-scoped candidate key. In some of these embodiments, thepermissions data is stored in a rules engine or in metadata associatedwith the candidate key. In other embodiments, the permission dataassociated with the candidate key is provided by the operating system.Further, the rules engine may include configuration settings instructingthe isolation environment to obey or override the native permission datafor virtualized copies of resources. In some embodiments, the rules mayspecify for some virtual resources the scope in which modifications areto occur, for example the system scope or the application isolationscope or a sub-scope, or the user isolation scope or a sub-scope. Insome embodiments, the rules engine may specify configuration settingsthat apply to subsets of the virtualized native resources based onhierarchy. In some of these embodiments, the configuration settings maybe specific to each atomic native resource.

If the permission data associated with the candidate key indicates thatit may not be modified, an error condition is returned to the requestor(step 838) indicating that modification of the key is not allowed. Ifthe permission data indicates that the key may be modified, thecandidate key is copied to the user isolation scope (step 840). In someembodiments, the candidate key is copied to a location defined by therules engine. For example, a rule may specify that the key is copied toanother application isolation scope. In other embodiments the rules mayspecify a particular application isolation sub-scope or user isolationsub-scope to which the key should be copied. Any ancestors of therequested key that do not appear in the isolation scope to which the keyis copied are created as placeholders in the isolation scope in order tocorrectly locate the copied instance in the hierarchy.

In some embodiments, metadata is associated with keys copied to theisolation scope that identifies the date and time at which the keys werecopied. This information may be used to compare the time stampassociated with the copied instance of the key to the time stamp of thelast modification of the original instance of the key or of anotherinstance of the key located in a lower isolation scope. In theseembodiments, if the original instance of the key, or an instance of thekey located in a lower isolation scope, is associated with a time stampthat is later than the time stamp of the copied key, that key may becopied to the isolation scope to update the candidate key. In otherembodiments, the copy of the key in the isolation scope may beassociated with metadata identifying the scope containing the originalkey that was copied.

In further embodiments, keys that are copied to isolation scopes becausethey have been opened with intent to modify them may be monitored todetermine if they are, in fact, modified. In one embodiment a copied keymay be associated with a flag that is set when the key is actuallymodified. In these embodiments, if a copied key is not actuallymodified, it may be removed from the scope to which it was copied afterit is closed, as well as any placeholder nodes associated with thecopied key.

The scoped instance is identified as the literal key (step 842) and arequest issued to open the literal key and the result returned to therequestor (step 820).

Returning to step 826, if the candidate key has neutral existencebecause the candidate key does not exist, or if the candidate key isfound but marked as a placeholder node, it is not yet known whether thevirtual key exists or not. In this case, the system-scoped key namecorresponding to the virtual key name is identified as the candidate keyname (step 830). In other words, the candidate key name is exactly thevirtual key name.

If the candidate key does not exist (step 832), an error conditionindicating the virtual key was not found is returned to the requestor(step 834). If on the other hand the candidate key exists (step 832),the request is checked to determine if the open request indicates anintention to modify the key (step 828).

As above, if the candidate key is being opened without the intent tomodify it, the system-scoped candidate key is identified as the literalkey for the request (step 818), and a request issued to open the literalkey and the result returned to the requestor (step 820). If, however, instep 828, it is determined that the open request indicates intention tomodify the key, permission data associated with the key is checked todetermine if modification of the key is allowed (step 836). In someembodiments, the permission data is associated with theapplication-scoped candidate key. In some of these embodiments, thepermissions data is stored in a rules engine or in metadata associatedwith the candidate key. In other embodiments, the permission dataassociated with the candidate key is provided by the operating system.Further, the rules engine may include configuration settings instructingthe isolation environment to obey or override the native permission datafor virtualized copies of resources. In some embodiments, the rules mayspecify for some virtual resources the scope in which modifications areto occur, for example the system scope or the application isolationscope or a sub-scope, or the user isolation scope or a sub-scope. Insome embodiments, the rules engine may specify configuration settingsthat apply to subsets of the virtualized native resources based onhierarchy. In some of these embodiments, the configuration settings maybe specific to each atomic native resource.

If the permission data associated with the system-scoped candidate keyindicates that the key may not be modified, an error condition isreturned to the requestor (step 838) indicating that modification of thekey is not allowed. If, however, the permission data indicates that thekey may be modified, the candidate key is copied to the user isolationscope (step 840). In some embodiments, the candidate key is copied to alocation defined by the rules engine. For example, a rule may specifythat the key is copied to an application isolation scope or that it maybe left in the system scope. In other embodiments the rules may specifya particular application isolation sub-scope or user isolation sub-scopeto which the key should be copied. Any ancestors of the requested keythat do not appear in the isolation scope are created as placeholders inthe isolation scope in order to correctly locate the copied instance inthe hierarchy.

In some embodiments, metadata is associated with keys copied to theisolation scope that identifies the date and time at which the keys werecopied. This information may be used to compare the time stampassociated with the copied instance of the key to the time stamp of thelast modification of the original instance of the key. In theseembodiments, if the original instance of the key is associated with atime stamp that is later than the time stamp of the copied key, theoriginal key may be copied to the isolation scope to update thecandidate key. In other embodiments, the candidate key copied to theisolation scope may be associated with metadata identifying the scopefrom which the original key was copied.

In further embodiments, keys that are copied to isolation scopes becausethey have been opened with intent to modify them may be monitored todetermine if they are, in fact, modified. In one embodiment a copied keymay be associated with a flag that is set when the key is actuallymodified. In these embodiments, if a copied key is not actuallymodified, when it is closed it may be removed from the scope to which itwas copied, as well as any placeholder nodes associated with the copiedkey. In still further embodiments, the key is only copied to theappropriate isolation scope when the key is actually modified.

The scoped instance is identified as the literal key (step 842) and arequest issued to open the literal key and the result returned to therequestor (step 820).

4.2.2 Registry Key Delete Operations

Referring now to FIG. 9, and in brief overview, one embodiment of thesteps taken to delete a registry key is depicted. Before a key can bedeleted, the key must first be opened successfully with delete access(step 901). If the key is not opened successfully, an error is returned(step 916). If the virtual key is opened successfully, a request todelete a virtualized registry key is received or intercepted, therequest including the handle to the literal key corresponding to thevirtual key (step 902). A rule determines how the registry key operationis processed (step 904). In addition to the rule applicable to the keyto be deleted, any other rules applicable to immediate subkeys areexamined (step 905). For each rule applicable to an immediate subkeyfound, an attempt is made to open a virtual subkey, with the virtualsubkey's name being specified by the name given in the rule found instep 905. If a subkey with a name corresponding to one of the rulesfound in step 905 is opened successfully (step 906), then the virtualkey is considered to have subkeys, which means it cannot be deleted, andan error returned (step 907).

If, after all the virtual key names extracted in step 905 have beenattempted to be opened (step 906), no virtual keys were found to exist,further examination is required. If the rule action is not “isolate”,but is “redirect”, or is “ignore” (step 908), a request to delete theliteral registry key is passed to the operating system and the resultfrom the operating system is returned to the requestor (step 911). Ifhowever the rule action determined in step 908 is “isolate” theaggregated virtualized registry key is consulted to determine if itcontains any virtual subkeys (step 914). If the virtualized key hasvirtual subkeys, then the deletion cannot continue, and an error isreturned indicating the key has not been deleted (step 920). If thevirtualized key does not have virtual subkeys, then the literal keycorresponding to the virtual key is examined to determine if it masks ascoped key with the same virtual name in another scope level (step 922).If the literal key corresponding to the virtual key does not mask adifferently scoped key with the same virtual name, then the literal keywhich corresponds to the virtual key is deleted, and the result returned(step 926). If the literal key corresponding to the virtual key masks adifferently scoped key with the same virtual name, then the literal keycorresponding to the virtual key is marked with a value indicating thatit is deleted, and a successful result returned to the caller (step924).

Still referring to FIG. 9, and in more detail, in order to delete a key,it must first be opened with delete access (step 901). The request toopen the key with delete access includes the name of the key which istreated as a virtual name by the isolation environment. A fullvirtualized key open is performed as described in section 4.2.1. If thevirtualized open operation fails, an error is returned to the requestor(step 916). If the virtualized open operation succeeds, the handle ofthe literal key corresponding to the virtual key is returned to therequestor. Subsequently a request to delete the registry key which wasopened in step 901 is received or intercepted (step 902). The openedliteral registry key may be of user isolation scope, applicationisolation scope, system scope, or some applicable isolation sub-scope.In some embodiments, the delete request is hooked by a function thatreplaces the operating system function or functions for deleting theregistry key. In another embodiment a hooking dynamically-linked libraryis used to intercept the delete request. The hooking function mayexecute in user mode or in kernel mode. For embodiments in which thehooking function executes in user mode, the hooking function may beloaded into the address space of a process when that process is created.For embodiments in which the hooking function executes in kernel mode,the hooking function may be associated with an operating system resourcethat is used in dispatching requests for native registry keys. In otherembodiments, a registry filter driver facility conceptually similar to afile system filter driver facility may be provided by the operatingsystem. A practitioner skilled in the art may create a registry filterdriver to which the operating system passes requests to perform registryoperations, thus providing a mechanism to intercept registry operationrequests. For embodiments in which a separate operating system functionis provided for each type of registry key function, each function may behooked separately. Alternatively, a single hooking function may beprovided which intercepts create or open calls for several types ofregistry key functions.

The delete request contains a literal key handle. The virtual key nameassociated with the handle is determined by querying the operatingsystem for the literal name associated with the handle. The rules engineis consulted to determine the virtual name associated with the literalname, if any. A rule determining how the registry key operation isprocessed (step 904) is obtained by consulting the rules engine. In someembodiments, the virtual key name of the virtual registry key to bedeleted is used to locate in the rule engine a rule that applies to therequest. In particular ones of these embodiments, multiple rules mayexist in the rules engine for a particular virtual registry key and, insome of these embodiments, the rule having the longest prefix match withthe virtual key name is the rule applied to the request. In someembodiments, the rules engine may be provided as a relational database.In other embodiments, the rules engine may be a tree-structureddatabase, a hash table, or a flat registry key database. In someembodiments, the virtual key name corresponding to the virtual keyhandle in the request is used as an index into a rules engine to locateone or more rules that apply to the request. In some embodiments, aprocess identifier is used to locate in the rule engine a rule thatapplies to the request, if one exists. The rule associated with arequest may be to ignore the request, redirect the request, or isolatethe request. The rule lookup may occur as a series of decisions, or therule lookup may occur as a single database transaction.

The virtual name of the key to be deleted is used to consult the rulesengine to locate the set of rules applicable to any immediate child keysof the virtual key to delete, but not applicable to the virtual key tobe deleted. This set of rules is located whether those child keys existor not (step 905). If this set of rules applicable to immediate childkeys is not empty, then the virtual name of each of these rules isextracted. An attempt is made to do a full virtualized open of each ofthe virtual child key names extracted, in turn (step 906). If any of thevirtual keys corresponding to any of these virtual names can be openedsuccessfully, then this means that a virtual subkey exists. This meansthat the virtual key cannot be deleted, as it has a virtual child thatexists, and an error is returned (step 907). If after examining all ofthe set of rules applicable to immediate children of the virtual key(step 905), no virtual subkeys are found to exist, the deletion cancontinue. For example, a key with virtual name “key_(—)1” may have childrules applicable to “key1\subkey_(—)1” and “key1\subkey_(—)2”. In thisstep, an attempt is made to do a virtualized open of “key1\subkey_(—)1”and “key1\subkey_(—)2”. If either of these virtual subkeys can be openedsuccessfully, then the deletion will fail, and an error is returned(step 907). Only if neither of these virtual subkeys exist can thedeletion continue.

If the rule action is not “isolate”, but is “redirect”, or is “ignore”(step 908), a request to delete the literal registry key using theliteral key handle is passed to the operating system and the result fromthe operating system is returned to the requestor (step 911). Thisrequest will fail if the literal key contains literal subkeys. In oneembodiment, the request to delete the literal registry key isaccomplished by calling the original version of the hooked function andpassing the literal key handle to the function as an argument. Inembodiments that make use of a registry filter driver, this isaccomplished by responding to the request with a completion status thatsignals the operating system to perform normal processing on therequest. In some embodiments, operating system permissions associatedwith the literal registry key may prevent its deletion. In theseembodiments, an error message is returned that the virtual registry keycould not be deleted.

If the rule action determined in step 908 is “isolate”, then theaggregated virtualized registry key is consulted to determine if itcontains any virtual subkeys (step 914). If the requested virtualregistry key contains virtual subkeys, then the virtual key cannot bedeleted, and an error is returned to the caller (step 920).

If the requested virtual registry key does not contain virtual subkeys,then the virtual key can be deleted. The action taken next depends onthe scope that contains the literal key to be deleted. For example, arequest to delete a virtual registry key may result in the deletion ofan application-scoped literal key. The scope containing the literal keycan be determined by consulting the rules engine with the full path tothe literal key.

If the literal key to be deleted is found in a particular scope, andthat literal key masks another key of the same virtual name in anotherscope, then the literal key to be deleted is marked as deleted, and aresult returned to the requestor (step 924). For example, a virtual keythat corresponds to a user-scoped literal key is considered to mask adifferently-scoped key if a corresponding application-scoped key withthe same virtual name or a corresponding system-scoped key with the samevirtual name has “positive existence”, that is, exists in the scope, andis not marked as a placeholder, and is not considered to be deleted.Similarly, an application-scoped key is considered to mask asystem-scoped key corresponding to the same virtual name if thatsystem-scoped key exists and is not considered to be deleted.

If the literal key to be deleted is found not to mask another key of thesame virtual name in another scope, then the literal key to be deletedis actually deleted and a result returned (step 926).

In some embodiments, operating system permissions associated with theliteral registry key may prevent deletion of the literal registry key.In these embodiments, an error message is returned that the virtualregistry key could not be deleted.

In some embodiments, the literal registry key may be associated withmetadata indicating that the virtualized registry key has already beendeleted. In some embodiments, metadata about a registry key may bestored in a distinguished value held by that key, with the existence ofthat value hidden from ordinary application usage of registry APIs. Insome embodiments, small amounts of metadata about a registry key may bestored directly in the literal key name, such as by suffixing thevirtual name with a metadata indicator, where a metadata indicator is astring uniquely associated with a particular metadata state. Themetadata indicator may indicate or encode one or several bits ofmetadata. Requests to access the key by virtual name check for possiblevariations of the literal key name due to the presence of a metadataindicator, and requests to retrieve the name of the key itself arehooked or intercepted in order to respond with the literal name. Inother embodiments, the metadata indicator may be encoded in a subkeyname or a registry value name instead of the key name itself. In stillother embodiments, a registry key system may directly provide theability to store some 3rd party metadata for each key. In someembodiments, metadata could be stored in a database or other repositoryseparate from the registry database. In some embodiments, a separatesub-scope may be used to store keys that are marked as deleted. Theexistence of a key in the sub-scope indicates that the key is marked asdeleted.

In specific ones of these embodiments, a list of deleted keys or keysystem elements may be maintained and consulted to optimize this checkfor deleted keys. In these embodiments, if a deleted key is recreatedthen the key name may be removed from the list of deleted keys. Inothers of these embodiments, a key name may be removed from the list ifthe list grows beyond a certain size.

In some embodiments, an ancestor of the literal registry key in the samescope is associated with metadata indicating that it is deleted, or isotherwise indicated to be deleted. In these embodiments, an errormessage may be returned indicating that the virtualized registry keydoes not exist. In specific ones of these embodiments, a list of deletedregistry keys or registry key system elements may be maintained andconsulted to optimize this check for deleted registry keys.

4.2.3 Registry Key Enumeration Operations

Referring now to FIG. 10, and in brief overview, one embodiment of thesteps taken to enumerate a key in the described virtualized environmentis shown. Before a key can be enumerated, the key must first be openedsuccessfully with enumerate access (step 1001). If the key is not openedsuccessfully, an error is returned (step 1040). If the virtual key isopened successfully, a request to enumerate is received or intercepted,the request including the handle to the literal key corresponding to thevirtual key (step 1002).

The virtual key name corresponding to the handle is determined, and therules engine is consulted to determine the rule for the key specified inthe enumerate request (step 1004). If the rule doesn't specify an actionof “isolate”, but instead specifies “ignore” or specifies “redirect”(step 1006), the literal key identified by the literal key handle isenumerated, and the enumeration results stored in a working data store(step 1012), followed by step 1030 as described later.

If, however, the rule action specifies “isolate,” firstly the systemscope is enumerated; that is, the candidate key name is exactly thevirtual key name, and if the candidate key exists it is enumerated. Theenumeration results are stored in a working data store. If the candidatekey does not exist, the working data store remains empty at this stage(step 1014). Next, the candidate key is identified as theapplication-scoped instance of the virtual key, and the category ofexistence of the candidate key is determined (step 1015). If thecandidate key has “negative existence”, i.e. it or one of its ancestorsin the scope is marked as deleted, then within this scope it is known tobe deleted, and this is indicated by flushing the working data store(step 1042). If instead the candidate key does not have negativeexistence, the candidate key is enumerated and any enumeration resultsobtained are merged into the working data store. In particular, for eachsubkey in the enumeration, its category of existence is determined.Subkeys with negative existence are removed from the working data store,and subkeys with positive existence, i.e. those that exist and are notmarked as placeholders and are not marked as deleted, are added to theworking data store, replacing the corresponding subkey if one is alreadypresent in the working data store (step 1016).

In either case, the candidate key is identified as the user-scopedinstance of the virtual key, and the category of existence of thecandidate key is determined (step 1017). If the candidate key has“negative existence”, i.e. it or one of its ancestors in the scope ismarked as deleted, then within this scope it is known to be deleted, andthis is indicated by flushing the working data store (step 1044). Ifinstead the candidate key does not have negative existence, thecandidate key is enumerated and any enumeration results obtained aremerged into the working data store. In particular, for each subkey inthe enumeration, its category of existence is determined. Subkeys withnegative existence are removed from the working data store, and subkeyswith positive existence, i.e. those that exist and are not marked asplaceholders and are not marked as deleted, are added to the workingdata store, replacing the corresponding subkey if one is already presentin the working data store (step 1018), followed by step 1030 asdescribed below.

Then, for all three types of rules, step 1030 is executed. The rulesengine is queried to find the set of rules whose filters match immediatechildren of the requested virtual key name, but do not match therequested virtual key name itself (step 1030). For each rule in the set,the existence of the virtual child whose name matches the name in therule is determined. If the child has positive existence, it is added tothe working data store, replacing any child of the same name alreadythere. If the child has negative existence, the entry in the workingdata store corresponding to the child, if any, is removed. (Step 1032).Finally, the constructed enumeration is then returned from the workingdata store to the requestor (step 1020).

Still referring to FIG. 10, and in more detail, in order to enumerate akey, it must first be opened with enumerate access (step 1001). Therequest to open the key with enumerate access includes the name of thekey which is treated as a virtual name by the isolation environment. Afull virtualized key open is performed as described in section 4.2.1. Ifthe virtualized open operation fails, an error is returned to therequestor (step 1040). If the virtualized open operation succeeds, thehandle of the literal key corresponding to the virtual key is returnedto the requestor. Subsequently a request to enumerate the registry keywhich was opened in step 1001 is received or intercepted (step 1002).The opened literal registry key may be of user isolation scope,application isolation scope, system scope, or some applicable isolationsub-scope. In some embodiments, the enumerate request is hooked by afunction that replaces the operating system function or functions forenumerating a registry key. In another embodiment a hookingdynamically-linked library is used to intercept the enumerate request.The hooking function may execute in user mode or in kernel mode. Forembodiments in which the hooking function executes in user mode, thehooking function may be loaded into the address space of a process whenthat process is created. For embodiments in which the hooking functionexecutes in kernel mode, the hooking function may be associated with anoperating system resource that is used in dispatching requests fornative registry keys. In other embodiments, a registry filter driverfacility conceptually similar to a file system filter driver facilitymay be provided by the operating system. A practitioner skilled in theart may create a registry filter driver to which the operating systempasses requests to perform registry operations, thus providing amechanism to intercept registry operation requests. For embodiments inwhich a separate operating system function is provided for each type ofregistry key function, each function may be hooked separately.Alternatively, a single hooking function may be provided whichintercepts create or open calls for several types of registry keyfunctions.

The enumerate request contains a literal key handle. The virtual keyname associated with the handle is determined by querying the operatingsystem for the literal name associated with the handle. The rules engineis consulted to determine the virtual name associated with the literalname, if any.

A rule determining how the registry key operation is processed (step1004) is obtained by consulting the rules engine. In some embodiments,the virtual key name of the virtual registry key to be enumerated isused to locate in the rule engine a rule that applies to the request. Inparticular ones of these embodiments, multiple rules may exist in therules engine for a particular virtual registry key and, in some of theseembodiments, the rule having the longest prefix match with the virtualkey name is the rule applied to the request. In some embodiments, therules engine may be provided as a relational database. In otherembodiments, the rules engine may be a tree-structured database, a hashtable, or a flat registry key database. In some embodiments, the virtualkey name corresponding to the virtual key handle in the request is usedas an index into a rules engine to locate one or more rules that applyto the request. In some embodiments, a process identifier is used tolocate in the rule engine a rule that applies to the request, if oneexists. The rule associated with a request may be to ignore the request,redirect the request, or isolate the request. The rule lookup may occuras a series of decisions, or the rule lookup may occur as a singledatabase transaction.

If the rule action is not “isolate” (step 1006), but is “ignore” or is“redirect”, then a request to enumerate the literal key is passed to theoperating system using the literal key handle, and the enumerationresults, if any, are stored in the working data store (step 1012), andstep 1030 is executed as described later.

In one embodiment, this is accomplished by calling the original versionof the hooked function and passing the formed literal name to thefunction as an argument. In other embodiments, a registry filter driverfacility conceptually similar to a file system filter driver facilitymay be provided by the operating system. In these embodiments,enumerating the literal registry key may be achieved by responding tothe original request to enumerate the key by signaling to the registryfilter manager to process the unmodified request in the normal fashion.

If the rule action determined in step 1010 is “isolate”, then the systemscope is enumerated. To achieve this, the candidate key is identified asthe system-scoped key corresponding to the virtual key to be enumerated.The candidate key is enumerated, and the results of the enumeration arestored in a working data store (step 1014). In some embodiments, theworking data store is comprised of a memory element. In otherembodiments, the working data store comprises a database or a key or asolid-state memory element or a persistent data store.

Next, the candidate key is identified as the application-scoped instanceof the virtual key, and the category of existence of the candidate keyis determined (step 1015). If the candidate key has “negativeexistence”, i.e. it or one of its ancestors in the scope is marked asdeleted, then within this scope it is known to be deleted, and this isindicated by flushing the working data store (step 1042).

In some embodiments, the candidate registry key may be associated withmetadata indicating that the candidate registry key has been deleted. Insome embodiments, metadata about a registry key may be stored in adistinguished value held by that key, with the existence of that valuehidden from ordinary application usage of registry APIs. In someembodiments, small amounts of metadata about a registry key may bestored directly in the literal key name, such as by suffixing thevirtual name with a metadata indicator, where a metadata indicator is astring uniquely associated with a particular metadata state. Themetadata indicator may indicate or encode one or several bits ofmetadata. Requests to access the key by virtual name check for possiblevariations of the literal key name due to the presence of a metadataindicator, and requests to retrieve the name of the key itself arehooked or intercepted in order to respond with the literal name. Inother embodiments, the metadata indicator may be encoded in a subkeyname or a registry value name instead of the key name itself. In stillother embodiments, a registry key system may directly provide theability to store some 3rd party metadata for each key. In someembodiments, metadata is stored in a database or other repositoryseparate from the registry database. In some embodiments, a separatesub-scope may be used to store keys that are marked as deleted. Theexistence of a key in the sub-scope indicates that the key is marked asdeleted.

If instead, in step 1015, the candidate key does not have negativeexistence, the candidate key is enumerated and any enumeration resultsobtained are merged into the working data store. In particular, for eachsubkey in the enumeration, its category of existence is determined.Subkeys with negative existence are removed from the working data store,and subkeys with positive existence, i.e. those that exist and are notmarked as placeholders and are not marked as deleted, are added to theworking data store, replacing the corresponding subkey if one is alreadypresent in the working data store (step 1016).

In either case, the candidate key is identified as the user-scopedinstance of the virtual key, and the category of existence of thecandidate key is determined (step 1017). If the candidate key has“negative existence”, i.e. it or one of its ancestors in the scope ismarked as deleted, then within this scope it is known to be deleted, andthis is indicated by flushing the working data store (step 1044). Ifinstead the candidate key does not have negative existence, thecandidate key is enumerated and any enumeration results obtained aremerged into the working data store. In particular, for each subkey inthe enumeration, its category of existence is determined. Subkeys withnegative existence are removed from the working data store, and subkeyswith positive existence, i.e. those that exist and are not marked asplaceholders and are not marked as deleted, are added to the workingdata store, replacing the corresponding subkey if one is already presentin the working data store (step 1018), followed by step 1030 asdescribed below.

Then, for all three types of rules, step 1030 is executed. The rulesengine is queried to find the set of rules whose filters match immediatechildren of the requested key, but do not match the requested key itself(step 1030). For each rule in the set, the existence of the virtualchild whose name matches the name in the rule is determined. In someembodiments, this is determined by examining the appropriate isolationscope and the metadata associated with the virtual child. In otherembodiments, this is determined by attempting to open the key. If theopen request succeeds, the virtual child has positive existence. If theopen request fails with an indication that the virtual child does notexist, the virtual child has negative existence.

If the child has positive existence, it is added to the working datastore, replacing any child of the same name already there. If the childhas negative existence, the child in the working data storecorresponding to the virtual child, if any, is removed. (Step 1032).Finally, the constructed enumeration is then returned from the workingdata store to the requestor (step 1020).

A practitioner of ordinary skill in the art will realize that thelayered enumeration process described above can be applied with minormodification to the operation of enumerating a single isolation scopewhich comprises a plurality of isolation sub-scopes. A working datastore is created, successive sub-scopes are enumerated and the resultsare merged into the working data store to form the aggregatedenumeration of the isolation scope.

4.2.4. Registry Creation Operations

Referring now to FIG. 11, and in brief overview, one embodiment of thesteps taken to create a key in the isolation environment is shown. Arequest to create a key is received or intercepted (step 1102). Therequest contains a key name, which is treated as a virtual key name bythe isolation environment. An attempt is made to open the requested keyusing full virtualization using applicable rules, i.e. using appropriateuser and application isolation scope, as described in section 4.2.1(step 1104). If access is denied (step 1106), an access denied error isreturned to the requestor (step 1109). If access is granted (step 1106),and the requested key is successfully opened (step 1110), the requestedkey is returned to the requestor (step 1112). However, if access isgranted (step 1106), but the requested key is not opened successfully(step 1110) then if the parent of the requested key also does not exist(step 1114), an error appropriate to the request semantics is issued tothe requestor (step 1116). If on the other hand, the parent of therequested key is found in full virtualized view using the appropriateuser and application scope (step 1114), a rule then determines how thekey operation is processed (step 1118). If the rule action is “redirect”or “ignore” (step 1120), the virtual key name is mapped directly to aliteral key name according to the rule. Specifically, if the rule actionis “ignore”, the literal key name is identified as exactly the virtualkey name. If, instead, the rule action is “redirect”, the literal keyname is determined from the virtual key name as specified by the rule.Then a request to create the literal key is passed to the operatingsystem, and the result is returned to the requestor (step 1124). If onthe other hand, the rule action determined in step 1120 is “isolate”,then the literal key name is identified as the instance of the virtualkey name in the user isolation scope. If the literal key already exists,but is associated with metadata indicating that it is a placeholder orthat it is deleted, then the associated metadata is modified to removethose indications, and it is ensured that the key is empty. In eithercase, a request to open the literal key is passed to the operatingsystem (step 1126). If the literal key was opened successfully (step1128), the literal key is returned to the requestor (step 1130). If onthe other hand, in step 1128, the requested key fails to open,placeholders for each ancestor of the literal key that does notcurrently exist in the user-isolation scope (step 1132) and a request tocreate the literal key using the literal name is passed to the operatingsystem and the result is returned to the requestor (step 1134).

Still referring to FIG. 11, and in more detail, a request to create akey is received or intercepted (step 1102). In some embodiments, therequest is hooked by a function that replaces the operating systemfunction or functions for creating the key. In another embodiment, ahooking dynamically-linked library is used to intercept the request. Thehooking function may execute in user mode or in kernel mode. Forembodiments in which the hooking function executes in user mode, thehooking function may be loaded into the address space of a process whenthat process is created. For embodiments in which the hooking functionexecutes in kernel mode, the hooking function may be associated with anoperating system resource that is used in dispatching requests for keyoperations. For embodiments in which a separate operating systemfunction is provided for each type of key operation, each function maybe hooked separately. Alternatively, a single hooking function may beprovided which intercepts create or open calls for several types of keyoperations.

The request contains a key name, which is treated as a virtual key nameby the isolation environment. In some embodiments, the virtual key namemay be expressed as a combination of a handle to a parent key, and therelative path name to the descendant key. The parent key handle isassociated with a literal key name, which is itself associated with avirtual key name. The requestor attempts to open the virtual key usingfull virtualization using applicable rules, i.e. using appropriate userand application isolation scope, as described in section 4.2.1 (step1104). If access is denied during the full virtualized open operation(step 1106), an access denied error is returned to the requestor (step1109). If access is granted (step 1106), and the requested virtual keyis successfully opened (step 1110), the corresponding literal key isreturned to the requestor (step 1112). However, if access is granted(step 1106), but the virtual key is not opened successfully (step 1110)then the virtual key has been determined not to exist. If the virtualparent of the requested virtual key also does not exist, as determinedby the procedures in section 4.2.1 (step 1114), an error appropriate tothe request semantics is issued to the requestor (step 1116). If on theother hand, the virtual parent of the requested virtual key is found infull virtualized view using the appropriate user and application scope(step 1114), then a rule that determines how the create operation isprocessed is located (step 1118) by consulting the rules engine. In someembodiments, the rules engine may be provided as a relational database.In other embodiments, the rules engine may be a tree-structureddatabase, a hash table, or a flat key database. In some embodiments, thevirtual key name provided for the requested key is used to locate in therule engine a rule that applies to the request. In particular ones ofthese embodiments, multiple rules may exist in the rules engine for aparticular key and, in some of these embodiments, the rule having thelongest prefix match with the virtual key name is the rule applied tothe request. In some embodiments, a process identifier is used to locatein the rule engine a rule that applies to the request, if one exists.The rule associated with a request may be to ignore the request,redirect the request, or isolate the request. Although shown in FIG. 11as a single database transaction or single lookup into a key, the rulelookup may be performed as a series of rule lookups.

If the rule action is “redirect” or “ignore” (step 1120), the virtualkey name is mapped directly to a literal key name according to the rule(step 1124). If the rule action is “redirect” (step 1120), the literalkey name is determined from the virtual key name as specified by therule (step 1124). If the rule action is “ignore” (step 1120), theliteral key name is determined to be exactly the virtual key name (step1124). If the rule action is “ignore” or the rule action is “redirect”,a request to create the literal key using the determined literal keyname is passed to the operating system and the result from the operatingsystem is returned to the requestor (step 1124). For example, a requestto create a virtual key named “key_(—)1” may result in the creation of aliteral key named “Different_key_(—)1.” In one embodiment, this isaccomplished by calling the original version of the hooked function andpassing the formed literal name to the function as an argument. (step1124). In other embodiments, a registry filter driver facilityconceptually similar to a file system filter driver facility may beprovided by the operating system. In these embodiments, creating theliteral registry key may be achieved by responding to the originalrequest to create the virtual key by signaling to the registry filtermanager to reparse the request using the determined literal key name.

If the rule action determined in step 1120 is not “ignore” or “redirect”but is “isolate,” then the literal key name is identified as theinstance of the virtual key name in the user isolation scope. If theliteral key already exists, but is associated with metadata indicatingthat it is a placeholder or that it is deleted, then the associatedmetadata is modified to remove those indications, and it is ensured thatthe key is empty.

In some embodiments, metadata about a registry key may be stored in adistinguished value held by that key, with the existence of that valuehidden from ordinary application usage of registry APIs. In someembodiments, small amounts of metadata about a registry key may bestored directly in the literal key name, such as by suffixing thevirtual name with a metadata indicator, where a metadata indicator is astring uniquely associated with a particular metadata state. Themetadata indicator may indicate or encode one or several bits ofmetadata. Requests to access the key by virtual name check for possiblevariations of the literal key name due to the presence of a metadataindicator, and requests to retrieve the name of the key itself arehooked or intercepted in order to respond with the literal name. Inother embodiments, the metadata indicator may be encoded in a subkeyname or a registry value name instead of the key name itself. In stillother embodiments, a registry key system may directly provide theability to store some 3rd party metadata for each key. In someembodiments, metadata could be stored in a database or other repositoryseparate from the registry database. In some embodiments, a separatesub-scope may be used to store keys that are marked as deleted. Theexistence of a key in the sub-scope indicates that the key is marked asdeleted.

In specific ones of these embodiments, a list of deleted keys or keysystem elements may be maintained and consulted to optimize this checkfor deleted keys. In these embodiments, if a deleted key is recreatedthen the key name may be removed from the list of deleted keys. Inothers of these embodiments, a key name may be removed from the list ifthe list grows beyond a certain size.

In either case, a request to open the user-scoped literal key is passedto the operating system (step 1126). In some embodiments, rules mayspecify that the literal key corresponding to the virtual key should becreated in a scope other than the user isolation scope, such as theapplication isolation scope, the system scope, a user isolationsub-scope or an application isolation sub-scope.

If the literal key was opened successfully (step 1128), the literal keyis returned to the requestor (step 1130). If on the other hand, in step1128, the requested key fails to open, placeholders are created for eachancestor of the literal key that does not currently exist in theuser-isolation scope (step 1132) and a request to create the literal keyusing the literal name is passed to the operating system and the resultis returned to the requestor (step 1134).

This embodiment is for operating systems with APIs or facilities thatonly support creation of one level per call/invocation. Extension tomulti-levels per call/invocation should be obvious to one skilled in theart.

4.3 Named Object Virtualization

Another class of system-scoped resources that may be virtualized usingthe techniques described above are named objects, which includesemaphores, mutexes, mutants, waitable timers, events, job objects,sections, named pipes, and mailslots. These objects are characterized inthat they typically exist only for the duration of the process whichcreates them. The name space for these objects may be valid over anentire computer (global in scope) or only in an individual user session(session scoped).

Referring now to FIG. 12, and in brief overview, a request to create oropen a named object is received or intercepted (step 1202). That requestcontains an object name which is treated as a virtual name by theisolation environment. A rule determining how to treat the request isdetermined (step 1204). If the rule indicates that the request should beignored (step 1206), the literal object name is determined to be thevirtual name (step 1207), and a request to create or open the literalobject is issued to the operating system (step 1214). If the determinedrule is not to ignore the request, but indicates instead that therequest should be redirected (step 1208), the literal object name isdetermined from the virtual name as specified by the redirection rule(step 1210) and a create or open request for the literal object isissued to the operating system (step 1214). If the rule does notindicate that the request should be redirected (step 1208), but insteadindicates that the request should be isolated, then the literal objectname is determined from the virtual name as specified by the isolationrule (step 1212) and a create or open command for the literal object isissued to the operating system (step 1214). The handle of the literalobject returned by the operating system in response to the issued createor open command is returned to the program requesting creation oropening of the virtual object (step 1216).

Still referring to FIG. 12, and in more detail, a request from a processto create or open a named object is intercepted (step 1202). The namedobject may be of session scope or it may be of global scope. In someembodiments, the request is hooked by a function that replaces theoperating system function or functions for creating or opening the namedobject. In another embodiment a hooking dynamically-linked library isused to intercept the request. The hooking function may execute in usermode or in kernel mode. For embodiments in which the hooking functionexecutes in user mode, the hooking function may be loaded into theaddress space of a process when that process is created. For embodimentsin which the hooking function executes in kernel mode, the hookingfunction may be associated with an operating system resource that isused in dispatching requests for system objects. The request to createor open the named object may refer to any one of a wide variety ofsystem-scoped resources that are used for interprocess communication andsynchronization and that are identified by a unique identifier includingsemaphores, mutexes, mutants, waitable timers, file-mapping objects,events, job objects, sections, named pipes, and mailslots. Forembodiments in which a separate operating system function is providedfor each type of object, each function may be hooked separately.Alternatively, a single hooking function may be provided whichintercepts create or open calls for several types of objects.

The intercepted request contains an object name which is treated as avirtual name by the isolation environment. A rule determining how totreat the request for the object is determined (step 1204) by consultingthe rules engine. In some embodiments, the rules engine may be providedas a relational database. In other embodiments, the rules engine may bea tree-structured database, a hash table, or a flat file database. Insome embodiments, the virtual name provided for the requested object isused to locate in the rule engine a rule that applies to the request. Inparticular ones of these embodiments, multiple rules may exist in therules engine for a particular object and, in these embodiments, the rulehaving the longest prefix match with the virtual name is the ruleapplied to the request. In some embodiments, a process identifier isused to locate in the rule engine a rule that applies to the request, ifone exists. The rule associated with a request may be to ignore therequest, redirect the request, or isolate the request. Although shown inFIG. 12 as a series of decisions, the rule lookup may occur as a singledatabase transaction.

If the rule indicates that the request should be ignored (step 1206),the literal object name is determined to be the virtual name, and arequest to create or open the literal object is issued to the operatingsystem (step 1214). For example, a request to create or open a namedobject named “Object_(—)1” will result in the creation of an actualobject named “Object_(—)1”. In one embodiment, this is accomplished bycalling the original version of the hooked function and passing theformed literal name to the function as an argument.

If the rule determined by accessing the rules engine is not to ignorethe request, but indicates instead that the request should be redirected(step 1208), the literal object name is determined from the virtual nameas specified by the redirection rule (step 1210) and a create or openrequest for the literal object is issued to the operating system (step1214). For example, a request to create or open a named object named“Object_(—)1” may result in the creation of an actual object named“Different_Object_(—)1”. In one embodiment, this is accomplished bycalling the original version of the hooked function and passing theformed literal name to the function as an argument.

If the rule does not indicate that the request should be redirected(step 1208), but instead indicates that the request should be isolated,then the literal object name is determined from the virtual name asspecified by the isolation rule (step 1212) and a create or open commandfor the literal object is issued to the operating system (step 1214).For example, a request to create or open a named object named“Object_(—)1” may result in the creation of an actual object named“Isolated_Object_(—)1”. In one embodiment, this is accomplished bycalling the original version of the hooked function and passing theformed literal name to the function as an argument.

The literal name formed in order to isolate a requested system objectmay be based on the virtual name received and a scope-specificidentifier. The scope-specific identifier may be an identifierassociated with an application isolation scope, a user isolation scope,a session isolation scope, or some combination of the three. Thescope-specific identifier is used to “mangle” the virtual name receivedin the request. For example, if the request for the named object“Object_(—)1” is isolated for the application-isolation scope whoseassociated identifier is “SA1”, the literal name may be“Isolated_AppScope_SA1_Object_(—)1”. The following table identifies theeffect of mangling the name of an object with session isolation scope,or user isolation scope, and an application isolation scope. Manglingwith combinations of scopes combines the restrictions listed in thetable.

Session- User- Application- specific specific specific identifieridentifier identifier Global Object Object Object object available toall available to all available to all isolated isolated isolatedapplications applications applications executing in executing onexecuting in the context of behalf of the application the user userisolation scope session Session Object Object Object object available toall available to all available to all isolated isolated isolatedapplications applications applications executing in executing inexecuting in the context of the session on the application the userbehalf of the isolation scope session user within the session

For embodiments in which the operating system is one of the WINDOWSfamily of operating systems, object scope may be modified by togglingthe global/local name prefix associated with the object, which, forisolated applications, has the same effect as mangling the object namewith a session-specific identifier. However, toggling the global/localname prefix also affects the object scope for non-isolated applications.

The handle of the literal object returned by the operating system inresponse to the command issued in step 1214 to create or open the namedobject is returned to the program requesting creation or opening of thevirtual object (step 1216).

4.4 Window Name Virtualization

Other classes of system-scoped resources that may be virtualized usingthe techniques described above are window names and window class names.Graphical software applications use the name of a window or its windowclass as a way of identifying if an application program is alreadyrunning and for other forms of synchronization. Referring now to FIG.13, and in brief overview, a request concerning a window name or windowclass is received or intercepted (step 1302). A request can be in theform of a Win32 API call or in the form of a Window message. Both typesof requests are handled. Those requests contain, or request retrievalof, window names and/or window class names that are treated as virtualnames by the isolation environment. If the request is to retrieve awindow name or window class for a window identified by a handle (step1304), a window mapping table is consulted to determine if the handleand the requested information concerning the window is known (step1306). If so, the requested information from the window mapping table isreturned to the requestor (step 1308). If not, the request is passed tothe operating system (step 1310), and the result returned to therequestor (step 1314). If, in step 1304, the request provides a windowname or window class, the request is checked to determine if itspecifies one of a class of windows defined by the operating system(step 1320). If it does, the request is issued to the operating systemand the result returned from the operating system is returned to therequestor (step 1322). If the request does not specify one of a class ofwindows defined by the operating system, the literal class name isdetermined based on the virtual class name and the rules (step 1324) andthe literal window name is determined based on the virtual window nameand the rules (step 1326). The request is then passed to the operatingsystem using the literal window and literal class names (step 1328). Ifeither the literal window name or literal window class name determinedin steps 1324 and 1326 differ from the corresponding virtual name, thenthe window mapping table entry for the window handle is updated torecord the virtual window name or virtual class name provided in therequest (step 1330). If the response from the operating system includesnative window names or native identifications of classes, those arereplaced with the virtual window name or virtual class name provided inthe request (step 1312) and the result is returned to the requestor(step 1314).

Still referring to FIG. 13, and in more detail a request concerning awindow name or window class is received or intercepted (step 1302).Those requests contain or request retrieval of window names and/orwindow class names that are treated as virtual names by the isolationenvironment.

If the request is to retrieve a window name or window class for a windowidentified by a handle (step 1304), a window mapping table is consultedto determine if the handle and the requested information concerning thewindow is known (step 1306). In some embodiments, instead of a mappingtable, additional data is stored for each window and window class usingfacilities provided by the operating system.

If so, the requested information from the window mapping table isreturned to the requestor (step 1308). If not, the request is passed tothe operating system (step 1310), and the result returned to therequestor (step 1314).

If, in step 1304, the request provides a window name or window class,the request is checked to determine if it specifies one of a class ofwindows defined by the operating system (step 1320). If it does, therequest is passed to the operating system and the result returned fromthe operating system is returned to the requestor (step 1322).

If the request does not specify one of a class of windows defined by theoperating system, the literal class name is determined based on thevirtual class name and the rules (step 1324) and the literal window nameis determined based on the virtual window name and the rules (step1326). The request is then passed to the operating system using theliteral window and literal class names (step 1328). In some embodimentsthe window names and window class names may be atoms, rather thancharacter string literals. Typically an application places a string inan atom table and receives a 16-bit integer, called an atom, that can beused to access the string.

If either the literal window name or literal window class namedetermined in steps 1324 and 1326 differ from the corresponding virtualname, then the window mapping table entry for the window handle isupdated to record the virtual window name or virtual class name providedin the request (step 1330).

If the response from the operating system includes native window namesor native identifications of classes, those are replaced with thevirtual window name or virtual class name provided in the request (step1312) and the result is returned to the requestor (step 1314).

Referring now to FIG. 13A, the literal window name or window class nameis determined as shown there. The rules engine is consulted to determinethe rule that applies to the request (step 1352). If the rule action is“ignore” (step 1354), then the literal name equals the virtual name(step 1356). If, however, the rule action is not “ignore” but is“redirect” (step 1358), then the literal name is determined from thevirtual name as specified by the redirect rule (step 1360). If, however,the rule action is not “redirect” but is “isolate”, then the literalname is determined from the virtual name using a scope-specificidentifier (step 1362).

In some embodiments, the particular scope-specific identifier isspecified in the rule. In other embodiments, the scope-specificidentifier used is the one associated with the application isolationscope with which the requesting process is associated. This allows thewindow or window class to be used by any other applications associatedwith the same application isolation scope. In operating systems such asmany of the Microsoft WINDOWS family of operating systems where windownames and classes are already isolated within a session, this means thatonly applications executing in the same session that are associated withthe same application isolation scope can use the window name or class.

In some of the family of Microsoft WINDOWS operating systems, the windowname is used as the title of the window in the title bar. It isdesirable to handle non-client area paint window message to ensure thatthe window title displayed in the window title bar reflects the virtualnames and not the literal name for a particular window. When anon-client area paint message is intercepted, the virtual nameassociated with the window, if any, is retrieved from the mapping table.If a virtual name is retrieved, the non-client area is painted using thevirtual name as the window title and it is indicated that the requestmessage has been handled. If no virtual name is retrieved, the requestis indicated as not handled, which passes the request on to the originalfunction that paints the title bar, using the literal name of thewindow.

4.5 Out-of-Process COM Server Virtualization

Software component technologies such as COM, CORBA, .NET and othersallow software components to be developed, deployed, registered,discovered, activated or instantiated and utilized as discrete units. Inmost component models, components may execute in either the process ofthe caller or in a separate process on the same computer or on aseparate computer entirely, although some components may only support asubset of these cases.

One or more unique identifiers identify these components. Typically thecomponent infrastructure provides a service or daemon that brokersactivation requests. A software process that wishes to begin using acomponent passes a request to the broker to activate the componentspecified by the component identifier. The broker activates therequested component, if possible, and returns a reference to theactivated instance. In some of these component infrastructures, multipleversions of the same component may not co-exist because the componentidentifier remains the same from version to version.

Some of the members of the WINDOWS family of operating systems provide acomponent infrastructure called COM. COM components (“COM servers”) areidentified by a GUID called a Class Identifier (CLSID), and eachcomponent provides one or more interfaces each of which has its ownunique interface identifier (UIID). The COM Service Control Manager(CSCM) is the broker for out-of-process activation requests and itprovides interfaces that allow the caller to request activation of a COMserver via CLSID. Although the following description will be phrased interms of COM servers and COM clients, it will be understood by one ofordinary skill in the art that it applies to CORBA, .NET, and othersoftware architectures that provide for dynamic activation of softwarecomponents.

When COM components are installed onto a computer, they register theirCLSIDs in a well-known portion of the registry database, along with theinformation needed by the CSCM to launch a new instance of the COMserver. For out of process COM servers, this may include the path andcommand line parameters to the executable to run. Multiple versions ofthe same COM server share the same CLSID, hence only one version can beinstalled onto a computer at a time.

In certain embodiments, an application (acting as a COM client)instantiates a COM server by calling a COM API (for example,CoCreateInstance( ) or CoCreateInstanceEx( )). A parameter to this callspecifies the desired activation context: in-process; out-of-process onthe same computer; out-of-process on a remote computer; or allow the COMsubsystem to determine which of these three cases to use. If it isdetermined that an out-of-process activation is required, the requestincluding the CLSID is passed to the CSCM. The CSCM uses the registrydatabase to locate the path and parameters needed to launch theexecutable that hosts the COM server. When that executable is launched,it registers all of the CLSIDs of all of the COM servers that itsupports with the CSCM using the COM API CoRegisterClassObject( ). Ifthe requested CLSID is registered, the CSCM returns a reference to thatCOM server to the caller. All subsequent interaction between the COMclient and the COM server takes place independently of the CSCM.

The isolation environment 200 previously described allows multipleinstances of COM servers with the same CLSID to be installed on acomputer, each in a different isolation scope (no more than one of whichmay be the system scope). However, this alone will not make those COMservers available to COM clients.

FIG. 14 depicts one embodiment of the steps to be taken to virtualizeaccess to COM servers. In brief overview, a new CLSID, hereinaftercalled the Isolated CLSID (or ICLSID) is created for each out-of-processCOM server that is launched into an isolation scope (step 1402). Bydefinition this is a CLSID, and thus must be unique amongst all otherCLSIDs, in other words it must have the properties of a GUID. A mappingtable is created that maps the pair (CLSID, application isolation scope)to ICLSID. A COM server registry entry is created for the ICLSID whichdescribes how to launch the COM server, with launch parameters thatstart the COM server executable in the appropriate application isolationscope (step 1404). Calls by COM clients to COM APIs such asCoCreateInstance( ) and CoCreateInstanceEx( ) are hooked or intercepted(step 1406). If it is determined that (a) the request can be satisfiedby an in-process COM server or (b) both the COM client and COM serverare not associated with any isolation scope, then the request is passedunmodified to the original COM API and the result returned to the caller(step 1408). The appropriate instance of the COM server to use isidentified (step 1410). If the selected COM server instance is in anapplication isolation environment its ICLSID is determined using thedata structures outlined above. Otherwise, the CLSID in the request isused (step 1412). The original CoCreateInstance( ) orCoCreateInstanceEx( ) function is called, with the ICLSID if one wasidentified in step 1412. This passes the request to the CSCM (step1414). The CSCM finds and launches the COM server executable in thenormal fashion, by looking up the requested CLSID in the registry todetermine launch parameters. If an ICLSID is requested, the ICLSIDsystem scope registry entry as described in step 1404 is found and theCOM server is launched in the appropriate application isolation scope(step 1416). The launched COM executable calls the hookedCoRegisterClassObject( ) API with the CLSIDs of the COM servers itsupports and these are translated to the appropriate ICLSIDs which arepassed to the original CoRegisterClassObject( ) API (step 1418). Whenthe CSCM receives a response from a CoRegisterClassObject( ) call withthe expected ICLSID, it returns a reference to that COM server instanceto the caller (step 1420).

Still referring to FIG. 14, and in more detail, an ICLSID is created foreach out-of-process COM server that is launched into an isolation scope(step 1402). In some embodiments, the ICLSID is created duringinstallation of the COM server. In other embodiments, the ICLSID iscreated immediately after installation. In still other embodiments, theICLSID is created before the COM server is launched into the isolationscope. In all of these embodiments, the ICLSID may be created by hookingor intercepting the system calls that create or query the CLSID entry inthe registry database. Alternatively, the ICLSID may be created byhooking or intercepting the COM API calls such as CoCreateInstance( )and CoCreateInstanceEx( ) that create COM server instances.Alternatively, changes to the CLSID-specific portion of the registrydatabase may be observed after an installation has taken place.

A mapping table is created that maps the pair (CLSID, applicationisolation scope) to ICLSID, along with the appropriate registry entriesfor a COM server with that ICLSID that describe how to launch the COMserver, with launch parameters that start the COM server executable inthe appropriate application isolation scope (step 1404). In manyembodiments, this table is stored in a persistent memory element, suchas a hard disk drive or a solid-state memory element. In otherembodiments, the table may be stored in the registry, in a flat file, ina database or in a volatile memory element. In still other embodiments,the table may be distributed throughout the COM-specific portions of theregistry database, for example by adding a new subkey specific to thispurpose to each appropriate COM server entry identified by CLSID.Entries in this table may be created during or immediately afterinstallation, by hooking or intercepting the calls that create the CLSIDentry in the registry database, or by observing changes to theCLSID-specific portion of the registry database after an installationhas taken place, or by hooking or intercepting the COM API calls such asCoCreateInstance( ) and CoCreateInstanceEx( ) that create COM serverinstances. Installation of a COM server into a specific isolation scopemay be persistently recorded. Alternatively, the mapping of a particularCOM server and isolation scope to ICLSID may be dynamically created andstored as an entry in a non-persistent database, or in the registrydatabase.

Calls by COM clients to COM APIs, such as CoCreateInstance( ) andCoCreateInstanceEx( ), are hooked or intercepted (step 1406). If it isdetermined that (a) the request can be satisfied by an in-process COMserver or (b) both the COM client and COM server reside in the systemscope (step 1407), then the request is passed unmodified to the originalCOM API and the result returned to the caller (step 1408).

If the request cannot be satisfied by an in-process COM server andeither the COM client or the COM server do not reside in the systemscope (step 1407), then the appropriate instance of the COM server touse is identified (step 1410). For embodiments in which COM clientsexecute in a particular isolation scope, preference may be given to COMservers installed into the same application isolation scope, followed bythose installed into the system scope (possibly executing in theclient's application isolation scope), followed by COM servers installedinto other application isolation scopes. In some of these embodiments,COM servers installed into the system scope may execute in the sameapplication isolation scope as the COM client. This may be controlled bythe rules engine and administrative settings to allow this to happen forCOM servers that execute correctly in this mode, and prevent it for COMservers that do not. For embodiments in which the COM client executes inthe system scope, preference may be given to system scope COM serversfollowed by COM servers in isolation scopes. The COM client may specifya COM server to use in the call creating an instance of the COM server.Alternatively, a configuration store may store information identifyingthe COM server to be instantiated. In some embodiments, the specifiedCOM server is hosted by another computer, which may be a separate,physical machine or a virtual machine. The mapping table described abovein connection with step 1404 may be used to find the set of applicableCOM servers and (if necessary) compute preference based on rules.

For embodiments in which the applicable COM server exists on anothercomputer, a service or daemon that executes on the remote computer canbe queried for the ICLSID to use. The COM client hook, if it determinesthat a remote COM server is required, first queries the service ordaemon to determine the CLSID/ICLSID to use. The service or daemondetermines an ICLSID corresponding to the CLSID given in the request. Insome embodiments, the ICLSID returned by the service or daemon may beselected or created based on administrator-defined configuration data,rules contained in a rules engine, or built-in hard-coded logic. Inother embodiments, the request may specify the isolation scope on theserver to be used. In still other embodiments, the requested COM servermay be associated with the server's system scope, in which case theCLSID associated with the COM server is returned. In still otherembodiments, the requested COM server may be associated with one of theserver's isolation scopes, in which case it returns the ICLSIDassociated with the instance of the COM server and the isolation scope.In some embodiments, a service or daemon as described above may be usedto support launching local out-of-process COM servers.

If the selected COM server instance is in an application isolationenvironment on the local computer, its ICLSID is determined using thedata structures described in connection with step 1404. If, instead, theselected COM server instance is in the system scope on the localcomputer, the CLSID in the request is used (step 1412). In some of theseembodiments, an entry for the COM server using the ICLSID may bedynamically created.

If an ICLSID is returned, it is passed to the original COM API in placeof the original CLSID. For example, the determined ICLSID may be passedto the original CoCreateInstance( ) or CoCreateInstanceEx( ) function,which passes the request to the CSCM (step 1414). For embodiments inwhich the COM server is hosted by another computer, the CSCM passes theICLSID to the computer hosting the COM server, where that computer'sCSCM handles the COM server launch.

The CSCM finds and launches the COM server executable in the normalfashion, by looking up the requested CLSID or ICLSID in the registry todetermine launch parameters. If an ICLSID is requested, the ICLSIDsystem scope registry entry as described in step 1404 is found and theCOM server launched in the appropriate application isolation scope (step1416).

If the launched COM server instance executes in an application isolationscope (whether installed into that scope or installed into the systemscope), the COM API function CoRegisterClassObject( ) of the COM serverinstance is hooked or intercepted. Each CLSID that is passed toCoRegisterClassObject( ) is mapped to the corresponding ICLSID, usingthe mapping table as defined in step 1404. The originalCoRegisterClassObject( ) API is called with the ICLSID (step 1418).

When the CSCM receives a response from a CoRegisterClassObject( ) callwith the expected ICLSID, it returns a reference to that COM serverinstance to the caller (step 1420).

This technique supports COM server execution when the COM client and COMserver execute in any combination of application isolation scopes(including different scopes) and the system scope. The ICLSID isspecific to the combination of server (identified by CLSID) and thedesired appropriate isolation scope. The client need only determine thecorrect ICLSID (or the original CLSID if the server is in installed intoand executing in the system scope).

4.6 Virtualized File Type Association (FTA)

File type association is a well-known graphical user interface techniquefor invoking execution of application programs. A user is presented witha graphical icon representing a data file. The user selects the datafile using keyboard commands or using a pointing device, such as amouse, and clicks, or double-clicks, on the icon to indicate that theuser would like to open the file. Alternately, in some computingenvironments, the user enters the path to the file at a command lineprompt in place of a command. The file typically has an associated filetype indication which is used to determine an application program to usewhen opening the file. This is generally done using a table that mapsthe file type indication to a specific application. In many members ofthe family of Microsoft WINDOWS operating systems, the mapping istypically stored in the registry database in a tuple including the filetype indicator and the full pathname identifying the application to beexecuted, and only one application program may be associated with anyparticular file type.

In the described isolation environment, multiple versions of anapplication may be installed and executed on a single computer. Thus, inthese environments, the relationship between file type and associatedapplication program is no longer a one-to-one relationship but is,instead, a one-to-many relationship. A similar problem exists for MIMEattachment types. In these environments, this problem is solved byreplacing the pathname identifying the application program to belaunched when a given file type is selected. The pathname is replacedwith that of a chooser tool that gives to the user a choice ofapplication programs to launch.

Referring now to FIG. 15, and in brief overview, a request to write filetype association data to a configuration store is intercepted (step1502). A determination is made whether the request is updating the filetype association information in the configuration store (step 1504). Ifnot, i.e., if the entry already exists, no update occurs (step 1506).Otherwise, a new entry is created using the virtualization techniquesdescribed above in sections 4.1.4 or 4.2.4, or the existing entry isupdated (step 1508). The new or updated entry, which is virtualized forthe appropriate isolation scope, maps the file type to a chooser toolwhich allows the user to select which of multiple application programsto use when viewing or editing the file.

Still referring to FIG. 15, and in more detail, a request to writefile-type association data to a configuration store is intercepted (step1502). In some embodiments, the configuration store is the WINDOWSregistry database. The request to write data to the configuration storemay be intercepted by a user mode hooking function, a kernel modehooking function, a file system filter driver, or a mini-driver.

A determination is made whether the request seeks to updatefile-type-association information in the configuration store (step1504). In one embodiment this is accomplished by detecting if theintercepted request indicates that it intends to modify theconfiguration store. In another embodiment, the target of the request iscompared to the information included in the request to determine if therequest is attempting to modify the configuration store. For embodimentsin which the configuration store is a registry database, the request tomodify the registry is intercepted, as described above in Section 4.2.

If it is determined that the request is not attempting to update theconfiguration store, no update occurs (step 1506). In some embodiments,it is determined that no attempt to update the configuration store ismade because the intercepted request is a read request. In otherembodiments, this determination may made when the target entry in theconfiguration store and the information included in the interceptedrequest are identical, or substantially identical.

If, however, it is determined in step 1504 that the request intends toupdate the configuration store, then a new entry is created in theconfiguration store, or the existing entry is updated (step 1508). Insome embodiments, rules determine which isolation scope the entry iscreated or updated in. In some embodiments, the new entry is created orthe existing entry is updated in the system scope or the applicationisolation scope. In many embodiments, the new entry is created or theexisting entry is updated in the appropriate user isolation scope. If anew entry is created, then it, rather than identifying the applicationprogram identified in the intercepted request, lists a chooserapplication as the application to be used when a file of a particulartype is accessed. In some embodiments, the chooser tool is updatedautomatically when a new version of an application program is installed,or when another application that handles the same file type isinstalled, or when an application registers or deregisters itself tohandle files of that particular type. In some embodiments, the choosertool can incorporate into its list of suitable applications anyapplications registered to handle the same file type in the portion ofthe configuration store maintained in other scopes, such as the systemscope, and the application scope if the chooser tool executes in theuser scope. If an existing entry is updated, and the existing entryalready lists the chooser application as the application to be used whena file of that particular file type is used, then the list ofapplications presented by the chooser for that file type may be updatedto include the updating application. If the existing entry is updated,but it does not list the chooser application, then the updated entry ismade to list the chooser application as the application to be used whena file of that particular file type is used. In these embodiments, theinformation relating to the associated applications may be stored in anassociated configuration file or, in some embodiments, as an entry inthe registry database.

The chooser application may present to the user a list of applicationsassociated with the selected file type. The application may also allowthe user to choose the application program that the user would like touse to process the file. The chooser then launches the applicationprogram in the appropriate scope: system scope; application isolationscope; or user isolation scope. In some embodiments, the chooser toolmaintains the identity of the default application program associatedwith a file type. In these embodiments, the default application may beused by processes that do not have access to the desktop or areconfigured to use the default handler without presenting the user with achoice.

4.7 Dynamic Movement of Processes Between Isolation Environments

An additional aspect of the invention is the facility to move a runningprocess between different virtual scopes. In other words, the aggregatedview of native resources presented to the application instance by theisolation environment 200 may be changed to a different aggregated viewwhile the application is executing. This allows processes that have beenisolated within a particular isolation scope to be “moved” to anotherisolation scope while the process is running. This is particularlyuseful for system services or processes of which only one instance mayexecute at a time, such as the MSI service in WINDOWS operating systems.This aspect of the invention may also be used to allow a user to work inseveral isolation scopes sequentially.

Referring to FIG. 16, and in brief overview, one embodiment of a processfor moving processes between one isolation scope and a second isolationscope, or between the system scope and an isolation scope, is shown. Asused in this description, the term “target isolation scope” will be usedto refer to the isolation scope, including the system scope, to whichthe processes is being moved and the term “source isolation scope” willbe used to refer to the isolation scope, including the system scope,from which the process is being moved. As shown in FIG. 16, and in briefoverview, a method for moving a process to a target isolation scopeincludes the steps of: ensuring that the process is in a safe state(step 1602); changing the association of the process from its sourceisolation scope to the target isolation scope in the rules engine (step1604); changing the association of the process from the source isolationscope to the target isolation scope for any filter driver or hooks (step1606); and allowing the process to resume execution (step 1608).

Still referring to FIG. 16, and in more detail, the process should be ina “safe” state while being moved to a different isolation scope (step1602). In some embodiments, the process is monitored to determine whenit is not processing requests. In these embodiments, the process isconsidered to be in a “safe” state for moving when no requests areprocessed by the process. In some of these embodiments, once the processis considered to be in a “safe” state, new requests to the process aredelayed until the process is moved. In other embodiments, such as inconnection with diagnostic applications, a user interface may beprovided to trigger the change in isolation scope. In these embodiments,the user interface may run code that puts the process to be moved into a“safe” state. In still other embodiments, an administration program mayforce the process into a “safe” state by delaying all incoming requeststo the process and waiting for the process to complete execution of anyactive requests.

The rules associated with the target isolation scope are loaded into therules engine if they do not already exist in the rules engine (step1603).

The association of the process with a source isolation scope is changedin the rules engine (step 1604). As described above, a process can beassociated with any isolation scope. That association is used by therules engine on every request for a virtual native resource to determinethe rule to apply to the request. The application instance can beassociated with a target isolation scope by changing the appropriatedata structures in the rules engine. In some embodiments, a new databaseentry is written associating the process with a new isolation scope. Inother embodiments, a tree node storing an identifier for the isolationscope with which the process is associated is overwritten to identifythe new isolation scope. In still other embodiments, an operating systemrequest can made to allocate additional storage for a process to storethe rules associated with the target isolation scope or, in someembodiments, an identifier of the rules.

The association of the process with the source isolation scope ischanged wherever the association or the rules are stored outside of therules engine, such as filter drivers, kernel mode hooks, or user modehooks (step 1606). For embodiments in which the association between aprocess and isolation scope rules is maintained based on PID, theassociation between the processes PID and the rule set is changed. Forembodiments in which a PID is not used to maintain the associationbetween a process and the applicable set of isolation rules, the usermode hooking function may be altered to access the rule set associatedwith the target isolation scope. For embodiments in which processassociations with rule sets for isolation scopes are maintained in arule engine, it is sufficient to change the association stored in therule engine in step 1604 above.

The process is allowed to resume execution in the new isolation scope(step 1610). For embodiments in which new requests were delayed orprohibited from being made, those requests are issued to the process andnew requests are allowed.

In one particularly useful aspect, the method described above may beused to virtualize MSI, an installation packaging and installationtechnology produced by Microsoft and available in some of the MicrosoftWINDOWS family of operating systems. An application packaged by thistechnology for installation is called an MSI package. Operating systemswhich support this technology have a WINDOWS service called the MSIservice which assists in installing MSI packages. There is a singleinstance of this service on the system. Processes that wish to installMSI packages run an MSI process in their session which makes COM callsto the MSI service.

MSI installations can be virtualized to install MSI packages into anapplication isolation environment. Conceptually, this can be achieved byhooking or intercepting the calls made to the MSI API in theinstallation session to the MSI service. A mutex can be used to ensurethat only one installation takes place at a time. When a call to the MSIAPI requesting to start a new installation is received or intercepted,and the calling process is associated with a particular applicationisolation scope, the MSI service is placed into the context of thatisolation scope before the call is allowed to proceed. The installationproceeds as the MSI service performs its normal installation actions,although native resource requests by the MSI service are virtualizedaccording to the applicable isolation scope. When the end of theinstallation process is detected, the association between the MSIservice and the isolation scope is removed. Although described abovewith respect to MSI, the technique described is applicable to otherinstallation technologies.

EQUIVALENTS

The present invention may be provided as one or more computer-readableprograms embodied on or in one or more articles of manufacture. Thearticle of manufacture may be a floppy disk, a hard disk, a CD-ROM, aflash memory card, a PROM, a RAM, a ROM, or a magnetic tape. In general,the computer-readable programs may be implemented in any programminglanguage, LISP, PERL, C, C++, PROLOG, or any byte code language such asJAVA. The software programs may be stored on or in one or more articlesof manufacture as object code.

Having described certain embodiments of the invention, it will nowbecome apparent to one of skill in the art that other embodimentsincorporating the concepts of the invention may be used. Therefore, theinvention should not be limited to certain embodiments, but rathershould be limited only by the spirit and scope of the following claims

What is claimed as new and desired to be protected by Letters Patent ofthe United States is:
 1. A method for virtualizing access to windows,the method comprising: receiving a request relating to a window from aprocess executing within the context of a user isolation scope, therequest including a virtual window name, and wherein the user isolationscope is provided by an isolation environment comprising a userisolation layer and an application isolation layer; selecting, by arules engine, a rule action associated with the request, the selectionresponsive to the request received from the process executing within thecontext of a user isolation scope, and determining that a rule actionfrom a group consisting of ignore, redirect and isolate, is associatedwith the request; determining a literal name for the window, in responseto the selected rule action, using a scope-specific identifierassociated with at least one of a particular user isolation scope and anapplication isolation scope; issuing to the operating system a requestincluding the determined literal window name; and associating a windowhandle with the virtual window name.
 2. The method of claim 1 whereinreceiving a request further comprises intercepting a request relating toa window from a process executing in the context of a user isolationscope, the request including a virtual window name.
 3. The method ofclaim 1 wherein receiving a request further comprises receiving arequest to find a window from a process executing in the context of auser isolation scope, the request including a virtual window name. 4.The method of claim 1 wherein receiving a request further comprisesreceiving a request to create a window from a process executing in thecontext of a user isolation scope, the request including a virtualwindow name.
 5. The method of claim 1 wherein determining a literal namefurther comprises: determining a rule associated with the virtual windowname included in the request; and determining a literal name for thewindow responsive to the determined rule.
 6. The method of claim 1wherein determining a literal name further comprises determining aliteral window name using a scope-specific identifier associated with anapplication isolation scope with which the process making the request isassociated.
 7. The method of claim 1 wherein associating a window handlefurther comprises storing the virtual window name in a mapping tableassociated with a window handle.
 8. The method of claim 1 furthercomprising receiving from the operating system a response to the issuedrequest.
 9. The method of claim 8 further comprising replacing theliteral window name in the response with a virtual window name.
 10. Themethod of claim 1 further comprising: receiving a request to identifyone of a virtual window name and a virtual window class identifier, therequest received from a process executing within the context of a userisolation scope and including a window handle, and wherein the userisolation scope is provided by an isolation environment comprising auser isolation layer and an application isolation layer; determiningthat the window handle is associated with the requested one of thevirtual window name and the virtual window class identifier; andreturning to the requesting process the determined window information.11. The method of claim 10 wherein determining that the window handle isassociated with the requested window name further comprises determiningwhether an association between the window handle and the requested oneof the virtual window name and the virtual window class identifierexists.
 12. The method of claim 11 further comprising determining thewindow handle associated with the requested one of the virtual windowname and the virtual window class identifier from a mapping table,responsive to determining an association exists in the mapping table.13. The method of claim 11 further comprising returning to therequesting process a response received from an operating system,responsive to determining no association exists in the mapping table.14. The method of claim 1 further comprising: intercepting a request,from a requestor executing within the context of an isolation scope, topaint a title bar for a window, the title bar including the window name,the request including a window handle, the isolation scope provided byan isolation environment comprising a user isolation layer and anapplication isolation layer; determining that the window handle isassociated with the virtual window name; painting the title bar of thewindow using the virtual window name; and indicating to the requestorthat the title bar has been painted.
 15. An apparatus for virtualizingaccess to windows comprising: a hooking mechanism, executing on acomputing device, receiving a request relating to a window from aprocess executing within the context of a user isolation scope, therequest including one of a virtual window name and a virtual windowclass identifier, and wherein the user isolation scope is provided by anisolation environment comprising a user isolation layer and anapplication isolation layer; a rules engine selecting a rule actionassociated with a request, the selection responsive to a requestreceived from a process executing within the context of a user isolationscope, and determining that a rule action from a group consisting ofignore, redirect and isolate, is associated with the request; a windowname virtualization engine, executing on the computing device, formingone of a literal name for the window and a literal window classidentifier, in response to the selected rule action, using the one ofthe virtual window name and the virtual window class identifier receivedin the request, and a scope specific identifier associated with aparticular isolation scope; and an operating system interface, executingon the computing device, issuing a request relating to a window, therequest including the one of the formed literal name and the formedliteral window class identifier for the window.
 16. The apparatus ofclaim 15 wherein the hooking mechanism intercepts a request selectedfrom a group consisting of finding a window, creating a window,enumerating a window, destroying a window, setting a window name,retrieving a window name, retrieving a window class identifierassociated with the window, registering a window class, retrievinginformation about a window class and unregistering a window class. 17.The apparatus of claim 15 further comprising a mapping table storing anassociation between a window handle and one of the virtual window nameand the virtual window class identifier.
 18. The apparatus of claim 17wherein the mapping table is associated with the process.
 19. Theapparatus of claim 18 further comprising a second mapping tableassociated with a second process.
 20. A method for virtualizing accessto windows, the method comprising: receiving a request, relating to awindow class, from a process executing within the context of a userisolation scope, the request including a virtual window classidentifier, and the user isolation scope provided by an isolationenvironment comprising a user isolation layer and an applicationisolation layer; selecting, by a rules engine, a rule action associatedwith the request, the selection responsive to the request received fromthe process executing within the context of a user isolation scope, anddetermining that a rule action from a group consisting of ignore,redirect and isolate, is associated with the request; determining aliteral window class identifier, in response to the selected ruleaction, using a scope-specific identifier associated with a particularisolation scope; issuing to an operating system a request including thedetermined literal window class identifier; and associating a windowhandle with the determined literal window class identifier.
 21. Themethod of claim 20 wherein receiving a request further comprisesintercepting a request relating to a window class from a processexecuting in the context of a user isolation scope, the requestincluding a virtual window class identifier.
 22. The method of claim 20wherein receiving a request further comprises receiving a request tofind a window from a process executing in the context of a userisolation scope, the request including a virtual window classidentifier.
 23. The method of claim 20 wherein receiving a requestfurther comprises receiving a request to create a window from a processexecuting in the context of a user isolation scope, the requestincluding a virtual window class identifier.
 24. The method of claim 20wherein determining further comprises: determining a rule associatedwith the virtual window class identifier included in the request; anddetermining a literal window class identifier responsive to thedetermined rule.
 25. The method of claim 20 wherein determining furthercomprises determining a literal window class name using a scope-specificidentifier associated with an application isolation scope with which theprocess making the request is associated.
 26. The method of claim 20wherein associating a window handle further comprises storing thevirtual window class identifier in a mapping table associated with awindow handle.
 27. The method of claim 20 further comprising receivingfrom the operating system a response to the issued request.
 28. Themethod of claim 27 further comprising replacing the determined literalwindow class identifier in the response with a virtual window classidentifier.